#include <bits/stdc++.h>
#define LL long long
#define maxn 500005
using namespace std;
int n, k, a[maxn], B[maxn];
LL ans, s[maxn], b[maxn], c[maxn];
bool cmp(int x, int y) {
	if (b[x] == b[y]) return x < y;
	else return b[x] < b[y];
}
inline void upd(int x) {
	while (x <= n + 1) {
		B[x]++;
		x += x & -x;
	}
}

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

int main() {
	scanf("%d%d", &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] - 1LL * k * i;
		c[i] = i;
	}
	sort(c, c + 1 + n, cmp);
	for (int i = 0; i <= n; i++) {
		ans += ask(c[i] + 1);
		upd(c[i] + 1);
	}
	printf("%lld\n", ans);
}

