#t544. 木材加工
木材加工
Wood Processing
Problem Description
To protect the environment, the lumber yard has logs and now wants to cut these logs into pieces of length each; there may be leftover material after cutting.
We want the resulting pieces to be as long as possible; find the maximum value of .
Lengths are measured in ; the logs have positive-integer lengths, and we require the cut pieces to have positive-integer lengths as well.
For example, given two logs of lengths and , to be cut into equal pieces, the longest possible piece length is clearly .
Input Format
The first line contains two positive integers : the number of logs and the number of pieces needed.
The next lines each contain a positive integer : the length of one log.
Output Format
One line: the maximum value of .
If even a -long piece cannot be cut, output .
Sample Input
3 7
232
124
456
Sample Output
114
Sample Explanation
For the first sample, the three logs have lengths , , and we need to cut out equal pieces. When the piece length is , the first log yields pieces, the second yields piece, and the third yields pieces, for a total of pieces, which exactly meets the requirement. If the length increases to , at most pieces can be cut, which is fewer than , so the maximum length is .
Constraints
For of the data, , , , where .