Problem 03C. Minimum Eating Speed ≡

Author:Pavel Mesenev   Time limit:2 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

There are n piles of bananas; pile i has ai bananas. There are H hours available. If the eating speed is k bananas per hour, then in one hour one pile is chosen and min(k, remaining in that pile) bananas are eaten; a pile that is finished early does not carry the spare time over. Pile i therefore takes ⌈ ai / k⌉ hours.

Find the smallest integer speed k ≥ 1 for which all piles can be finished within H hours, i.e. ∑i⌈ ai / k⌉  ≤ H.

Input format

The first line contains two integers n and H. The second line contains n integers a0… an − 1.

Output format

Print one integer — the minimum eating speed.

Constraints

1 ≤ n ≤ 105

n ≤ H ≤ 109

1 ≤ ai ≤ 109

Sample tests

No. Standard input Standard output
1
4 8
3 6 7 11
4
2
3 3
30 11 23
30
3
1 2
1000000000
500000000

0.039s 0.011s 18