On the occasion of Independence day Class Teacher of Shyamu gave him a task to distribute chocolate in the class .The class is consist of N students and Shyamu gave a[i] chocolate to ith student but some of students were not happy with the way he was distributing the chocolate because they were getting less number of chocolate than some other students.Then his class teacher arrived and decided to do some operation.
He performed the following type of operations:
Choose two student, increment the number of chocolate of one student by 1 and decrement the number of chocolate of other student by 1.
Find the minimum number of operations he had performed to make the absolute difference between the number of chocolate of any two student at most K.
Standard input
The first line contains two integers N and K.
The second line contains the N elements of each element represent the number of chocolate of ith student before the arrival of Class teacher.
Standard output
Print the minimum number of operations his teacher had performed.
Constraints.
1≤N≤10^5
1≤K≤10^9
1≤a[i] ≤10^5
This is initial number of chocolates that a student have!!
1 1 7 2 3 4
In first move Teacher had selected first and third student and incremented the number of chocolate of first student by 1 and decremented the number of chocolate of second student by 1
2 1 6 2 3 4
In second move he had done the same thing again with second and third student
2 2 5 2 3 4
In third move he had selected the third and fifth student and done the same thing
2 2 4 2 4 4
Now no pair have absolute difference greater than k=2;