#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define rep(i,x,y) for(int i=x;i<=y;++i)

const int INF=1<<30;
using namespace std;

typedef long long ll;
const int maxn=200000+10;

ll sum[maxn],t[maxn];

int n;
#define lowbit(i) ((i)&(-(i)))
int C[maxn];
void updata(int pos,int val){
	for(int i=pos;i<=n;i+=lowbit(i)) C[i]+=val;
}
int query(int pos){
	int ret=0;
	for(int i=pos;i;i-=lowbit(i)) ret=ret+C[i];
	return ret;
}

int main()
{
	ll k;cin>>n>>k;
	rep(i,1,n) 
	{
		scanf("%lld",sum+i);
		sum[i]-=k;sum[i]+=sum[i-1];t[i]=sum[i];
	}

	sort(t+1,t+n+1);
	int len=unique(t+1,t+n+1)-t-1;
	rep(i,1,n) sum[i]=lower_bound(t+1,t+len+1,sum[i])-t;

	ll ans=0;
	rep(i,1,n)
	{
		ans+=query(sum[i]);
		updata(sum[i],1);
		if(t[sum[i]]>=0) ++ans;
	}

	cout<<ans<<endl;
	return 0;
}
