#include <bits/stdc++.h>
#define PII pair<int, int>
#define LL long long
using namespace std;
const int MAXN = 200005;
const LL MOD = 998244353;
const LL INF = (LL)1e9 + 5;

struct BIT {
	int c[MAXN];
	void add(int p) {
		while (p < MAXN) {
			c[p]++;
			p += p & -p;
		}
	}
	int get(int p) {
		int res = 0;
		while (p > 0) {
			res += c[p];
			p -= p & -p;
		}
		return res;
	}
} tree;

int N, K, a[MAXN], pref[MAXN];
pair<LL, LL> ord[MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> N >> K;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		a[i] -= K;
		pref[i + 1] = pref[i] + a[i];
		ord[i + 1] = {pref[i + 1], i + 1};
	}
	ord[1] = {0, 1};
	
	int l = 1, r = 1;
	LL ans = 0;
	sort(ord + 1, ord + N + 2);
	while (l <= N) {
		while (r <= N + 1 && ord[r].first == ord[l].first) {
			tree.add(ord[r].second);
			r++;
		}
		for (int i = l; i < r; i++) {
			ans += tree.get(ord[i].second - 1);
		}
		l = r;
	}
	
	cout << ans << '\n';

	return 0;
}