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 "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;
int a[100006];


class BIT {
public:
	vector<int>bit;
	int N;
	void init(int n) {
		N = n;
		bit.resize(n + 1);
	}
	int sum(int i) {
		int s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i&-i;
		}
		return s;
	}
	void add(int i, int x) {
		while (i <= N) {
			bit[i] += x;
			i += i&-i;
		}
	}
};
BIT bit;

signed main() {
	int n, k; cin >> n >> k;
	rep(i, n) {
		cin >> a[i+1]; a[i+1] -= k;
	}
	rep(i, n)a[i + 1] += a[i];
	vector<P>V;
	rep(i, n + 1)V.push_back(P(a[i], i));
	sort(V.begin(), V.end());
	bit.init(n+1);
	int cnt = 0;
	rep(i, V.size()) {
		bit.add(V[i].second + 1, 1);
		cnt += bit.sum(V[i].second);
	}
	cout << cnt << endl;
}