// Solution of Problem : https://www.hackerrank.com/contests/hourrank-21/challenges/sams-numbers
// Change value of mod

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000009// Change mod value
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define space printf(" ")
#define endl printf("\n")
#define vi vector<int>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define mp make_pair
#define F first
#define S second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define slld(x) scanf("%lld", &(x))
#define plld(x) printf("%lld", (x))
#define plldn(x) printf("%lld\n", (x))
#define sllf(x) scanf("%llf", &(x))
#define pllf(x) printf("%.9llf", (x))
#define pllfn(x) printf("%.9llf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define all(a) (a).begin(), (a).end()
#define foreach(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin);freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp()//true for a before b
{
	bool ans = 0;
	return ans;
}

struct ST_Node
{
	ST_Node()
	{

	}
	void assign_value_()
	{

	}
	void merge_nodes_()
	{

	}
};

const int N = (2e5) + 9;
const int M = (1e5) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;

ll a[N], sum[N];
pli p[N];
int st[N<<3];

void build(int node, int l, int r)
{
	if(l == r)
	{
		st[node] = 1;
		return;
	}
	int mid = (l+r)>>1;
	int left = node<<1;
	int right = left|1;
	build(left,l,mid);
	build(right,mid+1,r);
	st[node] = st[left] + st[right];
	return;
}

void update(int node, int l, int r, int ind, int val)
{
	if(l > r || ind < l || ind > r)
		return;
	if(l == r)
	{
		st[node] = val;
		return;
	}
	int mid = (l+r)>>1;
	int left = node<<1;
	int right = left|1;
	update(left,l,mid,ind,val);
	update(right,mid+1,r,ind,val);
	st[node] = st[left] + st[right];
	return;
}

int query(int node, int l, int r, int p, int q)
{
	if(l > r || l > q || p > r)
		return 0;
	if(l >= p && r <= q)
		return st[node];
	int mid = (l+r)>>1;
	int left = node<<1;
	int right = left|1;
	return (query(left,l,mid,p,q)+query(right,mid+1,r,p,q));
}

int binsea(int l, int r, int n, ll val)
{
	if(l > r)
		return 0;
	int mid = (l+r)>>1;
	if(l == r)
	{
		if(p[mid].F >= val)
		{
			// cout << mid << '\n';
			return query(1,1,n,1,mid);
		}
		return 0;
	}
	if(p[mid].F >= val)
	{
		// cout << mid << '\n';
		return max(query(1,1,n,1,mid), binsea(mid+1,r,n,val));
	}
	return binsea(l,mid-1,n,val);
}

int ind[N];

int main()
{
	sws;
	// clock_t clk;
	// clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int n, i;
	ll k, ans = 0LL, temp;
	cin >> n >> k;
	fo(i,1,n+1)
		cin >> a[i];
	temp = k;
	sum[0] = 0LL;
	fo(i,1,n+1)
		sum[i] = sum[i-1] + a[i] - k;
	fo(i,1,n+1)
		p[i] = mp(sum[i], i);
	sort(p+1,p+n+1,greater< pli >());
	fo(i,1,n+1)
		ind[p[i].S] = i;
	build(1,1,n);
	fo(i,0,n)
	{
		ans += ((ll)binsea(1,n,n,sum[i]));
		update(1,1,n,ind[i+1],0);
	}
	cout << ans;
	// Code ends here

	// clk = clock() - clk;
	// cout << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 11520