We know that the chickpea refining and distribution company has a special place among…
- User
We know that the chickpea refining and distribution company has a special place among the people of Barre.
In line with this goal, Salar Chickpea Refining and Distribution Company (with limited liability) plans to supply the chickpeas needed by the people of Barre next year. In line with this goal, Kayanush has compiled a list of the amount of peas needed by each lamb household. According to the estimate in Barre n n families live that i The first of them in the next year to a i a i Kilo of chickpeas will be needed.
The company head has been negotiated m m kilos of chickpeas have been imported. We know that any household that receives less than its requirement of chickpeas will curse Nisar Salarkhan according to the square of the difference between the amount received and the requested amount. If Salar Khan optimally distributes the peas among the households, get the least negative number he hears (note that Salar Khan can only give positive and non-negative numbers of kilos of peas to each household).
input In the first line m m, the amount of peas that Salar Khan has, and n n is the number of lamb households. The next line shows the amount of chickpeas consumed by each household. It is guaranteed that the amount of chickpeas imported by Salar company is always less than the total chickpea consumption of all Barre households. 1 ≤ m , a i ≤ 2 x 1 0 9 1 ≤ m, a i ≤2×10 9
1 ≤ n ≤ 100
000 1≤n≤100 000
output Print the least negative that becomes Nisar Salarkhan in the optimal state.
It is guaranteed that the answer to the problem is never from 4 x 1 0 18 4 x 10 18 It doesn't get more.
Example Sample entry 1 5 3 1 3 2 Plain text Sample output 1 1 Plain text Explanation of the first example:
Salar Khan gives 1 kilo of chickpeas to the first household and 2 kilos of chickpeas to each of the second and third households.
Sample input 2 10 4 4 5 2 3 Plain text Sample output 2 4 c++
- Assistant