favorite We need a little bit of your help to keep things running, click on this banner to learn more

29 June Session 5 Binary Search


The beach stretches along the seacoast like a narrow strip. At some points of the beach the ice cream stalls are located. One day not all the ice cream sellers come to work. Distribute the sellers among the ice-cream stalls so that the minimum distance between them is as much as possible. So they will interfere less with each other.


The first line contains the number of stalls n (2 < n < 10001) and the number of ice cream sellers k (1 < k < n) at work. The second line contains n positive integers in increasing order - the coordinates of the stalls (the coordinates are not greater than 109).


Print one number - the minimum distance between the adjacent stalls in the optimal arrangement.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 3
1 2 3 100 1000
Output example #1