Time limit
2s
Memory limit
128 MB
You have K cables with different lengths. By cutting these cables, you need to make at least N cables, all with the same length.
There is no length lost while cutting, and cut pieces cannot be joined back together. The chosen length must be a positive integer number of centimeters. Making more than N cables also satisfies the requirement.
Find the maximum possible length of the equal cables.
The first line contains the number of cables you already have, K, and the required number of cables, N.
1 <= K <= 10,0001 <= N <= 1,000,000K <= NEach of the next K lines contains the length of one cable as a positive integer in centimeters. Each length is at most 2^31 - 1.
Print the maximum integer length, in centimeters, that allows you to make at least N cables.
If the length is 200cm, the cables of lengths 802cm, 743cm, 457cm, and 539cm produce 4, 3, 2, and 2 pieces respectively, for a total of 11 pieces.