#include <cstdio>
using namespace std;

long long N, K, a[200005];
long long tmp[200005];
long long ans;

long long msort(long long A[], long long B[], long long l, long long r) {
	if (l >= r) return 0;
	long long m = (l + r) >> 1;
	long long tot = msort(A, B, l, m) + msort(A, B, m + 1, r);
	long long i = l, j = m + 1, k = l;
	while (i <= m && j <= r)
		if (A[i] <= A[j]) B[k++] = A[i++];
		else B[k++] = A[j++], tot += m - i + 1;
	while (i <= m) B[k++] = A[i++];
	while (j <= r) B[k++] = A[j++];
	for (long long i = l; i <= r; ++i) A[i] = B[i];
	return tot;
}

int main() {
    scanf("%lld%lld", &N, &K);
    for (int i = 1; i <= N; ++i)
        scanf("%lld", &a[i]), a[i] -= K;
    for (int i = 1; i <= N; ++i) a[i] += a[i - 1];
    ans = ((N + 1) * N >> 1) - msort(a, tmp, 0, N);
    printf("%lld\n", ans);
    return 0;
}
