#include<stdio.h>
#include<malloc.h>
int i;
long long k,a[200005],sum[200005];
long long n,num;
void merge(long long *x,int left,int mid,int right)
{
	long long *temp=(long long*)malloc(sizeof(long long)*(right-left+5));
	int i=left,j=mid+1,tempnum=0;
	while(i<=mid&&j<=right)
	{
		if(sum[i]<=sum[j])
			temp[tempnum++]=sum[i++];
		else
		{
			temp[tempnum++]=sum[j++];
			num+=mid+1-i;
			//printf("%d %d %d %d\n",i,mid,right,num);			
		}
	}
	while(i<=mid)
		temp[tempnum++]=sum[i++];
	while(j<=right)
		temp[tempnum++]=sum[j++];
	for(i=left;i<=right;++i)
		sum[i]=temp[i-left];
	free(temp);
}
void mergesort(long long *x,int left,int right)
{
	int mid=(left+right)>>1;
	if(left>=right)
		return ;
	mergesort(x,left,mid);
	mergesort(x,mid+1,right);
	merge(x,left,mid,right);
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for(i=1;i<=n;++i)
	{
		scanf("%lld",a+i);
		*(a+i)-=k;
		*(sum+i)=*(sum+i-1)+*(a+i);
	}
	//printf("%d\n",num);
	mergesort(sum,0,n);
	printf("%lld\n",n*(n+1)/2-num);
	return 0;
}