#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,K,a[210000],na[210000],f[210000],gt,g[210000];
long long s[210000],ans;
inline bool cmp(int a,int b){
	return s[a]<s[b];
}
inline void add(int x){
	while (x<=gt){
		f[x]++;
		x+=x&(-x);
	}
}
inline void ask(int x){
	while (x){
		ans+=f[x];
		x-=x&(-x);
	}
}
int main(){
	scanf("%d%d",&n,&K);
	fo(i,1,n){
		scanf("%d",&a[i]);
		a[i]-=K;
	}
	fo(i,1,n) s[i]=s[i-1]+a[i];
	fo(i,0,n) na[i]=i;
	sort(na,na+n+1,cmp);
	g[na[0]]=gt=1;
	fo(i,1,n) g[na[i]]=(s[na[i]]!=s[na[i-1]])?++gt:gt;
	add(g[0]);
	fo(i,1,n){
		ask(g[i]);
		add(g[i]);
	}
	printf("%lld\n",ans);
	return 0;
}