Koko Eating Bananas
Given piles of bananas and H hours, find the minimum eating speed to finish all piles within H hours.
Input format
The first line contains N (number of piles) and H (available hours, H ≥ N). The second line contains N pile sizes.
Output format
Print the minimum integer eating speed K (bananas/hour) that finishes all piles within H hours. A pile of size p takes ceil(p / K) hours.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
4 8
3 6 7 11Expected output
4Example 2
Input
3 5
30 11 23Expected output
15