spoj#MEANARR. Mean of array
Mean of array
After checking his coders' skills about strings, professor Mahammad wants to analyze how well the coders are familiar with arrays. As the professor is very good at math, he is curious about adding some mathematical background to his new problem. Now, the problem asks you to find the number of subarrays in which the mathematical mean is not less than given K. Mean is the function which defines the average of the corresponding list. More clearly, in order to find the mean of the array, we can divide the sum of the numbers by the number of elements in it.
Input
The first line of the input contains two positive integers N and K, the number of elements of the array and the mean, respectively. (N ≤ 200000).
The following line contains N integers which represent elements of the array.
All the numbers in the input section are 32-bit positive integers.
Output
Output one integer representing the number of subarrays in which the mean is not less than K.
Example
Input:5 4
5 2 4 5 1
Output: 5
Note: The subarrays, satisfying the condition are: [5], [5, 2, 4, 5], [4], [5], [4, 5].