~/algor $ cat problems/qidiruv-eng-katta-minimal-masofa
Largest minimum distance
Medium
1000 ms
128 MB
62%
There are $n$ posts on a line, the $i$-th post is at point $p_{i}$. $k$ guards must be placed at different posts so that the distance between the two closest guards is as large as possible. Find the largest value of this distance.
Input
The first line contains two positive integers: $n$ and $k$. The second line contains $n$ distinct integers $p_{i}$ separated by spaces (in any order).
Output
One integer — the largest value of the distance between the two closest guards.
Note
$2 \le k \le n \le 10^{5}$
$0 \le p_{i} \le 10^{9}$, all $p_{i}$ are distinct
Examples
Input #1
5 3 1 2 8 4 9
Output #1
3
Input #2
4 2 10 1 5 7
Output #2
9