Nobita has started taking Programming Classes. His teacher has given him a new assignment. Nobita has solved all the questions except for the last one. He needs your help in solving the last question. The question is:
Given an array of n integers.Convert it to an array with at least k equal numbers in minimum operation.
In one operation, you can choose any ai and set a[i]=a[i]/2(rounding down) , where a is the array given as input and i is any index of the array.
Can you help him to solve the problem?
Input Format
The first line contains two integer n (the number of elements in the array) and k ( as defined in problem).
Next line contains n space separated integer - the elements of the array.
Constraints
1<= n <= 100000
1<= k <=n
1 <= a[i] <= 100000
Output Format
Print a single integer equal to the minimum operation required.
Sample Input
4 4
1 1 1 4
Sample Output
2
Explanation
To get at least 4 equal numbers, we can do 4 -> 2 -> 1.
Then the array will be [1,1,1,1].
The number of operation is 2 (4 -> 2 then 2-> 1).