#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
inline int read(){
	int ans=0,fh=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') fh=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		ans=(ans<<1)+(ans<<3)+ch-'0',ch=getchar();
	return ans*fh;
}
const int maxn=2e5+100;
int n,k,a[maxn],b[maxn],siz[maxn<<2],mx;
map<int,int>bh;
inline void lsh(){
	for(int i=1;i<=n;i++) b[i]=a[i];
	sort(b+1,b+n+1),b[0]=b[1]-1;
	for(int i=1;i<=n;i++)
		if(b[i]!=b[i-1]) bh[b[i]]=++mx;
	for(int i=1;i<=n;i++) a[i]=bh[a[i]];
}
void insert(int o,int l,int r,int qz){
	siz[o]++;
	if(l==r) return;
	int mid=l+r>>1;
	if(qz<=mid) insert(o<<1,l,mid,qz);
	else insert(o<<1|1,mid+1,r,qz);
}
int query(int o,int l,int r,int qz){
	if(l==r) return l<=qz?siz[o]:0;
	int mid=l+r>>1;
	if(qz<=mid) return query(o<<1,l,mid,qz);
	else return query(o<<1|1,mid+1,r,qz)+siz[o<<1];
}
int main(){
//	freopen("nh.in","r",stdin);
	n=read(),k=read();
	for(int i=1;i<=n;i++)
		b[i]=read()-k;
	for(int i=1;i<=n+1;i++) a[i]=a[i-1]+b[i-1];
	n++,lsh();
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=query(1,1,mx,a[i]);
		insert(1,1,mx,a[i]);
	}
	printf("%lld\n",ans);
	return 0;
}








