#P7713. Maximizing Final Score at the Olympics

    ID: 20900 Type: Default 1000ms 256MiB

Maximizing Final Score at the Olympics

Maximizing Final Score at the Olympics

At the Olympics, contestant A is scored by n judges with scores \(a_1, a_2, \ldots, a_n\). Dissatisfied with his score, A is allowed to perform at most m operations. In one operation, he can choose any judge and increase that judge's score by 1.

After all operations, his final score is calculated by removing one judge with the highest score and one judge with the lowest score from the list, and then taking the average of the remaining scores. In formula, if the final scores are \(b_1,b_2,\ldots,b_n\), his final score is computed as:

[ Final\ Score = \frac{\sum_{i=1}^{n}b_i - \max_{1 \le i \le n}b_i - \min_{1 \le i \le n}b_i}{n-2} ]

Your task is to help A obtain the maximum possible final score by choosing an optimal way to distribute the operations. Note that operations add exactly 1 point and the contestant can only increase scores.

inputFormat

The first line contains two integers n and m (with n \ge 3), where n is the number of judges and m is the maximum number of operations A can perform.

The second line contains n space-separated integers \(a_1, a_2, \ldots, a_n\) representing the scores given by the judges.

outputFormat

Output a single number, which is the maximum possible final score A can achieve. The answer will be accepted if it has an absolute or relative error of at most \(10^{-6}\).

sample

3 0
1 5 6
5.000000