#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5;

int n, k;
long long a[N], fw[N];
vector<long long> vec;

void upd(int p,int v) {
	for (; p <= vec.size(); p += p & -p) fw[p] += v;
}

int get(int p) {
	int ret = 0;
	for (; p > 0; p -= p & -p) ret += fw[p];
	return ret;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		a[i] -= k;
	}
	int sum = 0;
	vec.push_back(0);
	for (int i = 1; i <= n; ++i) {
		a[i] += a[i - 1];
		vec.push_back(a[i]);
	}
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	for (int i = 0; i <= n; ++i) {
		a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin() + 1;
	} 
	long long ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans += get(a[i]);
		upd(a[i], 1);
	}
	cout << ans << '\n';
}