#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MOD(x) ((x)%mod)
int n;
long long mean;
long long a[200005]; 
long long s[200005]; 
long long temp[200005]; 
long long ans;
void merge(int l,int r)
{
	int m=(l+r)/2;
	int h1=l,h2=m+1;
	int t1=m,t2=r;
	if(h1<t1) merge(h1,t1);
	if(h2<t2) merge(h2,t2);
	for(int i=l;i<=r;i++)	
	{
		if(h1<=t1&&h2<=t2)
		{
			if(s[h1]>s[h2])
			{
				temp[i]=s[h1++];
			}
			else
			{
				temp[i]=s[h2++];
				ans+=t1-h1+1;
			}
		}
		else if(h1<=t1)
		{
			temp[i]=s[h1++];
		}
		else
		{
			temp[i]=s[h2++];
		}
	}
	for(int i=l;i<=r;i++)
		s[i]=temp[i];
}
int main()
{
	scanf("%d%lld",&n,&mean);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		a[i]-=mean;
		s[i]=s[i-1]+a[i];
	}
	merge(1,n);
	for(int i=1;i<=n;i++)
		if(s[i]>=0) ans++;
	printf("%lld",ans);
	return 0;
}