# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>g;
vector<edge>ed;
vector<Pll>pv;
set<LL>st;
map<Pll, LL>ma;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
string str, ss;
bool f;
LL n, m, s, t, h, w,sum[300000];
//注意:配列を1から始めること
class BIT {
public:
	vector<LL> Bit;
	LL M;
	BIT(LL M) :
		Bit(vector<LL>(M + 1, 0)), M(M) {}
	LL sum(LL i) {
		LL s = 0;
		while (i>0) {
			s += Bit[i];
			i -= (i&(-i));
		}
		return s;
	}
	LL sum(LL i, LL j) {
		return sum(j) - sum(i - 1);
	}
	//1-index
	void add(LL i, LL x) {
		while (i <= M) {
			Bit[i] += x;
			i += (i&(-i));
		}
	}
	//初めてk以上になる、index
	int lower_bound(LL k) {
		int l = -1, r = n + 1, m;
		while (r - l>1) {
			m = (l + r) / 2;
			if (sum(m) >= k)
				r = m;
			else l = m;
		}
		return (r == n + 1 ? -1 : r);
	}
	//初めてkより大きくなる、index
	int upper_bound(LL k) {
		int l = -1, r = M + 1, m;
		while (r - l > 1) {
			m = (l + r) / 2;
			if (sum(m) > k)
				r = m;
			else l = m;
		}
		return (r == M + 1 ? M + 1 : r);
	}
};
map<LL,LL> zip;
int unzip[300000];
int compress(vector<LL> &x) {
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for (int i = 0; i < x.size(); i++) {
		zip[x[i]] = i;
		unzip[i] = x[i];
	}
	return x.size();
}
vector<LL>v;
int main() {
	cin >> n >> m;
	v.push_back(0);
	rep(i, n) {
		LL x;
		cin >> x;
		x -= m;
		sum[i + 1] = sum[i] + x;
		v.push_back(sum[i+1]);
	}
	compress(v);
	BIT bit(300000);
	LL ans = 0;
	rep(i, n + 1) {
		ans+=bit.sum(zip[sum[i]]+1);
		bit.add(zip[sum[i]]+1, 1);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19056