#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int N, K;
int a[200010];
struct Node{
	///int val;///
	long long val;
	int cnt;
	int num;
	struct Node *left, *right;
};
struct Node root;
long long res=0;
long long sum[200010];
long long Tree[800000];
long long Left[800000], Right[800000];
long long sum3[200010];
int n;
int NN;

/*void add_tree(long long v)
{
	struct Node *p = &root;
	struct Node *last = p;
	int flag;
	while(1){
		if(p == 0){
			p = new struct Node;
			p->num = p->cnt = 1;
			p->left = p->right = 0;
			p->val = v;
			if(flag == 0)
				last->left = p;
			else
				last->right = p;
			break;
		}
		p->num ++;
		if(p->val == v){
			p->cnt ++;
			break;
		}
		else if(p->val > v){
			last = p;
			flag = 0;
			p = p->left;
		}
		else{
			last = p;
			flag = 1;
			p = p->right;
		}
	}
}

int find_tree(long long v)
{
	int cc = 0;
	struct Node *p = &root;
	while(1){
		if(p == 0)
			break;
		if(p->val == v){
			cc += p->cnt;
			if(p->left != 0)
				cc += p->left->num;
			break;
		}
		else if(p->val < v){
			cc += p->cnt;
			if(p->left != 0)
				cc += p->left->num;
			p = p->right;
		}
		else{
			p = p->left;
		}
	}
	return cc;
}*/

/*long long val2[400010];//会比指针快，但还是超时 
int cnt2[400010];
int num2[400010];
int left2[400010], right2[400010];
int nx2 = 1;
void add_tree(long long v)
{
	int p = 1;
	int last = p;
	int flag;
	while(1){
		if(p == 0){
			nx2 ++;
			p = nx2;
			num2[p] = cnt2[p] = 1;
			left2[p] = right2[p] = 0;
			val2[p] = v;
			if(flag == 0)
				left2[last] = p;
			else
				right2[last] = p;
			break;
		}
		num2[p] ++;
		if(val2[p] == v){
			cnt2[p] ++;
			break;
		}
		else if(val2[p] > v){
			last = p;
			flag = 0;
			p = left2[p];
		}
		else{
			last = p;
			flag = 1;
			p = right2[p];
		}
	}
}

int find_tree(long long v)
{
	int cc = 0;
	int p = 1;
	while(1){
		if(p == 0)
			break;
		if(val2[p] == v){
			cc += cnt2[p];
			if(left2[p] != 0)
				cc += num2[left2[p]];
			break;
		}
		else if(val2[p] < v){
			cc += cnt2[p];
			if(left2[p] != 0)
				cc += num2[left2[p]];
			p = right2[p];
		}
		else{
			p = left2[p];
		}
	}
	return cc;
}*/

/*void solve()
{
	int i;
	res = 0;
	for(i=0; i<N; i++)
		a[i] -= K;
	sum[0] = a[0];
	for(i=1; i<N; i++)
		sum[i] = sum[i-1] + a[i];
	if(sum[0] >= 0)
		res ++;
	//root.val = sum[0];
	//root.cnt = 1;
	//root.num = 1;
	//root.left = root.right = 0;
	val2[1] = sum[0];
	cnt2[1] = num2[1] = 1;
	left2[1] = right2[1] = 0;
	for(i=1; i<N; i++){
		if(sum[i] >= 0)
			res ++;
		int cc = find_tree(sum[i]);
		res += cc;
		add_tree(sum[i]);
	}
	printf("%lld\n", res);
}*/

int srch(int nd, long long ll, long long rr)
{
	if(Left[nd]>=ll && Right[nd]<=rr)
		return Tree[nd];
	if(Left[nd]>rr || Right[nd]<ll)
		return 0;
	int c1 = srch(2*nd, ll, rr);
	int c2 = srch(2*nd+1, ll, rr);
	return c1+c2;
}

int find_tree(long long v)
{
	int nd = 1;
	//int cc = srch(nd, -1000000000, v);
	int cc = srch(nd, sum3[0], v);
	return cc;
}

void add_tree(long long v)
{
	int l=0, r=NN-1;
	int mm;
	while(l<=r){
		mm = (l+r)/2;
		if(sum3[mm] == v)
			break;
		else if(sum3[mm] < v)
			l = mm+1;
		else
			r = mm-1;
	}
	int nd = mm+n;
	while(nd>=1){
		Tree[nd] ++;
		nd /= 2;
	}
}

void solve()
{
	int i;
	res = 0;
	for(i=0; i<N; i++)
		a[i] -= K;
	sum[0] = a[0];
	for(i=1; i<N; i++)
		sum[i] = sum[i-1] + a[i];
	for(i=0; i<N; i++)
		sum3[i] = sum[i];
	sort(sum3, sum3+N);
	NN = 1;
	for(i=1; i<N; i++){
		if(sum3[i] != sum3[i-1]){
			sum3[NN] = sum3[i];
			NN ++;
		}
	}
	n = 1;
	while(n<N){
		n *= 2;
	}
	for(i=0; i<NN; i++)
		Left[n+i] = Right[n+i] = sum3[i];
	for(; i<n; i++)
		Left[n+i] = Right[n+i] = Left[n+i-1]+1;
	for(i=n-1; i>=1; i--){
		Left[i] = Left[2*i];
		Right[i] = Right[2*i+1];
	}
	for(i=0; i<N; i++){
		if(sum[i] >= 0)
			res ++;
		int cc = find_tree(sum[i]);
		res += cc;
		add_tree(sum[i]);
	}
	printf("%lld\n", res);
}

int res2=0;
void solve2()
{
	int i, j;
	res2 = 0;
	for(i=0; i<N; i++){
		long long ss = 0;
		for(j=i; j<N; j++){
			ss += a[j];
			double d = ss;
			d /= j-i+1;
			if(d >= K)
				res2 ++; 
		}
	}
}

void test()
{
	int i, k;
	for(k=0; k<1; k++){
		N = 100000;
		K = rand();
		for(i=0; i<N; i++){
			a[i] = rand();
			//a[i] = 1000000000;
		}
		//solve2();
		solve();
		if(res != res2){
			printf("Wrong\n");
		}
	}
}

int main()
{
	//test();
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d%d", &N, &K);
	for(i=0; i<N; i++)
		scanf("%d", &a[i]);
	solve();
	return 0;
}

Measured memory_bytes: 22784