Children in a kindergarten have received a large sack containing candies. It has been decided that the candies are to be distributed among children.
Each child has stated the number of candies that it wants. If a child isn't given the amount of candy it wants, it will get angry. In fact it'll get angrier for each candy it is deprived of. Some speculate that its anger will be equal to the square of the number of candy it is deprived of. For instance, if Mirko states that he wants candies but receives only , he would be missing candies, so his anger would be equal to .
Unfortunately, there is an insufficient amount of candy to satisfy all children. Therefore, the candies should be distributed in such a way that the sum of the children's anger is minimal.
Input Specification
The first line contains two integers, and .
The following lines contain integers (one per line) which represent the wishes of the children. Those numbers are all strictly less than , and their sum always exceeds .
Test cases worth of total points have not greater than .
Test cases worth of total points have no child state that it wants more than candies.
Test cases worth of total points have at least one of the above stated constraints will be met.
Output Specification
The first and only line of output must contain the minimum sum of the children's anger.
Note: Please output your answer modulo . Use int64
in Pascal, long long
in C/C++, long
in Java.
Sample Input 1
5 3
1
3
2
Sample Output 1
1
Sample Input 2
10 4
4
5
2
3
Sample Output 2
4
Comments