Processing math: 100%
Reading - MarisaOJ: Marisa Online Judge

Reading

Time limit: 1000 ms
Memory limit: 256 MB
Marisa has n books, with the i-th book located at position Ai. She wants to select k books to read. Marisa believes that if she selects two books too close to each other, it will affect the aesthetic value of the books. Therefore, she wants to find a way to choose k books such that the minimum distance between any two consecutive books selected is as large as possible. For example, if Marisa selects books at positions 1,3,7,10, the minimum distance between any two consecutive books is 2, which is the distance between the books at positions 1 and 3. ### Input - The first line contains two integers n,k. - The second line contains n integers Ai. No two books occupy the same position. ### Output - The maximum distance ensuring she can select exactly k books. ### Constraints - 1≤n≤105. - 1≤Ai,k≤109. ### Sample Input: 53104231 Output: 3