#include<cstdio>
#include<ctime>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 200005;
int n, m;
long long k, ans;
long long a[MAXN];
long long t[MAXN];
long long b[MAXN];
long long Query(int x)
{
	long long ret = 0;
	while(x)
	{
		ret += b[x];
		x -= (x & -x);
	}
	return ret;
}
void Insert(int x)
{
	while (x <= m+1)
	{
		++b[x];
		x += (x & -x);
	}
}
int main()
{
	scanf("%d%lld", &n, &k);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%lld", &a[i]);
		t[i] = (a[i] += a[i-1] - k);
	}
	sort(t, t + n + 1);
	m = unique(t, t + n + 1) - t + 1;
	for (int i = 0; i <= n; ++i)
	{
		a[i] = lower_bound(t, t + m, a[i]) - t + 1;
		ans += Query(a[i]);
		Insert(a[i]);
	}
	printf("%lld", ans);
	return 0;
}