#include<bits/stdc++.h>
using namespace std;

char gc() {
	return getchar();
}

template<typename T>
int read(T &ans) {
	ans=0;T f=1;
	char ch=gc();
	while(!isdigit(ch)) {
		if(ch==EOF) return EOF;
		if(ch=='-') f=-1;
		ch=gc();
	}
	while(isdigit(ch))
		ans=ans*10+ch-'0',ch=gc();
	ans*=f;
	return 1;
}

template<typename T1,typename T2>
int read(T1 &a,T2 &b) {
	return read(a)!=EOF&&read(b)!=EOF?2:EOF;
}

template<typename T1,typename T2,typename T3>
int read(T1 &a,T2 &b,T3 &c) {
	return read(a,b)!=EOF&&read(c)!=EOF?3:EOF;
}

typedef long long ll;
const int Maxn=210000;
const ll inf=100000000000000ll;

ll ans,a[Maxn],b[Maxn];
int cnt,t[Maxn],n,k;

int query(int x,int ans=0) {
	for(int i=x;i;i&=i-1) ans+=t[i];
	for(int i=x;i<=cnt;i+=i&-i) t[i]++;
	return ans;
}

int main() {
//	freopen("test.in","r",stdin);
	read(n,k);
	for(int i=1;i<=n;i++) {
		read(a[i]);
		a[i]-=k;
	}
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<=n;i++) b[i]=a[i];
	sort(b,b+n+1);
	map<ll,int> ma;
	for(int i=0;i<=n;i++)
		if(i==0||b[i]!=b[i-1]) {
			cnt++;
			ma[b[i]]=cnt;
		}
	for(int i=0;i<=n;i++)
		ans+=query(ma[a[i]]);
	cout<<ans<<endl;
	return 0;
}
