Problem: K Average Ranges

Given the sequence a_1, a_2, .., a_N.

How many intervals in this sequence have an average value of K or more and a length of 1 or more?

input


N K
a_1 a_2 ... a_N


output

Output the answer.

Constraint

* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq K \ leq 10 ^ 9
* 1 \ leq a_i \ leq 10 ^ 9



Input example


6 6
8 6 9 1 2 1


Output example


7






Example

Input

6 6
8 6 9 1 2 1


Output

7

Solution (in CPP):

Solution:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//BIT(蟻本）
struct edge { int to, cost; };
int n, k;
int a[114514];
int memo[114514];
int bit[114514];
P p[114514];
//BIT(蟻本）
int sum(int i) {
	int s = 0;
	while (i) {
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
void add(int i, int x) {
	while (i <= n) {
		bit[i] += x;
		i += i & -i;
	}
}
signed main() {
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	rep(i, n)a[i] = a[i] - k;
	memo[0] = 0;
	for (int i = 1; i <= n; i++)memo[i] = memo[i - 1] + a[i - 1];
	rep(i, n + 1)p[i].first = memo[i], p[i].second = i;
	sort(p, p + n + 1);
	int q = 0;
	rep(i, n + 1) {
		if (p[i].first == p[i + 1].first && i < n) {
			memo[p[i].second] = q + 1;
		}
		else {
			memo[p[i].second] = q + 1;
			q++;
		}
	}
	int ans = 0;
	rep(i, n + 1) {
		ans += sum(memo[i]);
		add(memo[i], (int)1);
	}
	cout << ans << endl;
	ggr
}