#include<bits/stdc++.h>
#define lson(x) (x<<1)
#define rson(x) ((x<<1)|1)
using namespace std;

typedef long long ll;
typedef vector<int> vii;

const int maxn=200003;
const int inf=0x3f3f3f3f;

int n,k,b[maxn];
ll pre[maxn],a[maxn],res,sum[maxn<<2];

void update(int id,int l,int r,int pos){
	++sum[id];
	if(l==r) return ;
	int mid=(l+r)/2;
	if(mid>=pos) update(lson(id),l,mid,pos);
	else update(rson(id),mid+1,r,pos);
}

ll query(int id,int l,int r,int L,int R){
	if(l>=L&&r<=R) return sum[id];
	if(l>R||L>r) return 0;
	int mid=(l+r)/2;
	return query(lson(id),l,mid,L,R)
		  +query(rson(id),mid+1,r,L,R);
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i){
		scanf("%lld",&pre[i]);
		pre[i]-=k;
		pre[i]+=pre[i-1];
		a[i]=pre[i];
		if(a[i]>=0) ++res;
	}
	sort(a+1,a+n+1);
	int U=unique(a+1,a+n+1)-a-1;
	for(int i=1;i<=n;++i)
		b[i]=lower_bound(a+1,a+n+1,pre[i])-a;
	for(int i=1;i<=n;++i){
		res+=query(1,1,n,1,b[i]);
		update(1,1,n,b[i]);
	}
	printf("%lld\n",res);
	return 0;
}