K Average Ranges

Given the sequence a_1, a_2, .., a_N.

How many intervals in this sequence have an average value of K or more and a length of 1 or more?

input


N K
a_1 a_2 ... a_N


output

Output the answer.

Constraint

* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq K \ leq 10 ^ 9
* 1 \ leq a_i \ leq 10 ^ 9



Input example


6 6
8 6 9 1 2 1


Output example


7






Example

Input

6 6
8 6 9 1 2 1


Output

7
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//1-indexed
#include<vector>
template<typename T>
struct BIT{
	int n;
	vector<T>bit;
	BIT(int n_=0):n(n_),bit(n_+1){}
	T sum(int i)
	{
		T ans=0;
		for(;i>0;i-=i&-i)ans+=bit[i];
		return ans;
	}
	void add(int i,T a)
	{
		if(i==0)return;
		for(;i<=n;i+=i&-i)bit[i]+=a;
	}
	int lower_bound(T k)//k<=sum(ret)
	{
		if(k<=0)return 0;
		int ret=0,i=1;
		while((i<<1)<=n)i<<=1;
		for(;i;i>>=1)
			if(ret+i<=n&&bit[ret+i]<k)k-=bit[ret+=i];
		return ret+1;
	}
};
int N,K;
int A[1<<17];
int main()
{
	cin>>N>>K;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];A[i]-=K;
	}
	long S=0;
	vector<long>X(1,0);
	for(int i=0;i<N;i++)
	{
		S+=A[i];
		X.push_back(S);
	}
	sort(X.begin(),X.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	BIT<int>P(X.size());
	long ans=0;S=0;
	for(int i=-1;i<N;i++)
	{
		if(i>=0)S+=A[i];
		int id=lower_bound(X.begin(),X.end(),S)-X.begin();
		ans+=P.sum(id+1);
		P.add(id+1,1);
	}
	cout<<ans<<endl;
}

