Problem: You are given an array of integers and an integer . It is guaranteed that is odd.
In one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations required to make the median of the array being equal to .
The median of the array with odd length is the value of the element which is located on the middle position after the array is sorted. For example, the median of the array is equal to , since if we sort this array we will get , and is located on the middle position.
Input Format: The first line contains two integers and (, ) — the length of the array and the required value of median.
The second line contains integers () — the elements of the array .
It is guaranteed that is odd.
Output Format: In a single line output the minimum number of operations to make the median being equal to .
Note: In the first sample, can be increased twice. The array will transform to , which becomes after sorting, hence the median is equal to .
In the second sample, can be increased once and can be increased five times. The array will become equal to . If we sort this array we get , this way the median is .