Problem: 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

Solution (in CPP):

Solution:
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-4;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>int LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>int UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
llint solve(vector<llint>&wa,int L,int R){
	if(L+1==R){return 0;}
	int M=(L+R)/2;
	llint ans=solve(wa,L,M)+solve(wa,M,R);
	//分割統治をおこなう
	vector<llint>ata;
	ata.reserve(R-L);
	int Lb=L,Rb=M;
	while(-1){
		if(Lb==M&&Rb==R){break;}
		else if(Lb==M){ata.pub(wa[Rb]);Rb++;ans+=M-Lb;}
		else if(Rb==R){ata.pub(wa[Lb]);Lb++;}
		else if(wa[Lb]<=wa[Rb]){ata.pub(wa[Rb]);Rb++;ans+=M-Lb;}
		else		  {ata.pub(wa[Lb]);Lb++;}
	}
	for(int i=L;i<R;i++){wa[i]=ata[i-L];}
	return ans;
}
int main(void){
	int i,n,K;cin>>n>>K;
	vector<llint>wa(n+1);
	for(i=0;i<n;i++){
		llint x;cin>>x;
		wa[i+1]=wa[i]+x-K;
	}
	cout<<solve(wa,0,n+1)<<endl;
	//2 0 3 -5 -4 -5
	//0 2 2 5 0 -4 -9
	//5 2 2 0 0 -4 -9
	return 0;
}