#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
#define hash hashh
using namespace std;

const int N = 3e5;
const int inf = 1e9;

int n, k, a[N], B[N];
ll ans, s[N], b[N], c[N];

bool cmp(int i, int j) {
	if (b[i] == b[j]) return i < j;
	return b[i] < b[j];
}

void ins(int x) {
	while (x <= n + 1) {
		B[x]++;
		x += x & -x;
	}
}

int ask(int x) {
	int res = 0;
	while (x) {
		res += B[x];
		x -= x & -x;
	}
	return res;
}

int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	for (int i = 1; i <= n; i++) {
		s[i] = s[i - 1] + a[i];
		b[i] = s[i]- (ll)k * i;
		c[i] = i;
	}
	sort(c, c + 1 + n, cmp);
	for (int i = 0; i <= n; i++) {
		ans += ask(c[i] + 1);
		ins(c[i] + 1);
	}
	cout << ans;
}

