Deputy Ties
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Once upon a time, during a long night plenary session of the Verkhovna Rada, the female half of the deputies noticed that not all male deputies came wearing ties. "What an outrageous horror!" — they thought. Moreover, those male deputies who did have ties did not coordinate their lengths. And we call this the face of the country?!
So without wasting time, the women gathered all available ties and decided to craft new ties from them for all the men at the session. Their goal is ties of equal length on all deputies who call themselves men. To do this, the women can cut the ties with scissors an arbitrary number of times. Along with this, the female deputies want to make the new identical ties as long as possible.
So your task is to help the women find the maximum length!
Input
The first line contains two positive integers \(n\) and \(m\) — the number of gathered ties and the number of male deputies at the plenary session, respectively.
The second line contains \(n\) positive integers \(a_i\) — the length of the \(i\)-th gathered tie.
Output
In a single line, print one number — the maximum tie length.
The answer will be considered correct if its absolute or relative error does not exceed \(10^{-4}\).
Constraints
\(1 \le n, m \le 1000\),
\(1 \le a_i \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 3 4 1 10 5 | 3.3333333 |
Notes
The second tie can be cut into three equal pieces, each of length \(\frac{10}{3}\). From the third tie, another tie of length \(\frac{10}{3}\) can be cut out, and the remainder can be discarded along with the first short tie. Now all four men who came to the session will be able to wear a tie of length \(\frac{10}{3}\).
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|