#include<iostream>
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;
const int MAXN = 100010;
int a[MAXN],b[MAXN],c[MAXN],sum[MAXN];
map<int,int> mp;
int n,k,nn;
int lowbit(int x) {return x&(-x);}
int getSum(int x) {
	int ans = 0;
	while (x>0) {
		ans += sum[x];
		x -= lowbit(x);
	}
	return ans;
}
void update(int x,int num) {
	while (x<=nn) {
		sum[x] += num;
		x += lowbit(x);
	}
}
int main()
{
	while (scanf("%d%d",&n,&k)!=EOF) {
		for (int i=1;i<=n;i++) scanf("%d",&a[i]);
		c[0] = 0,b[0] = 0;
		for (int i=1;i<=n;i++) {
			c[i] = c[i-1] + a[i] - k;
			b[i] = c[i];
		}
		sort(b,b+1+n);
		nn = 0;
		mp.clear();
		for (int i=0;i<=n;i++) {
			if (!mp[b[i]]) mp[b[i]] = ++nn;
		}
		long long ans = 0;
		for (int i=0;i<=n;i++) {
			ans += getSum(mp[c[i]]);
			update(mp[c[i]],1);
		}
		printf("%lld\n",ans);
	}
}