#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


template <class Tp>
struct fenwick_tree{
	typedef unsigned size_type;
	std::vector<Tp> bit;

	fenwick_tree(){}
	explicit fenwick_tree(size_type n){
		init(n);
	}
	void init(size_type n){
		bit.assign(n + 1, Tp());
	}
	Tp sum(size_type i) const{
		Tp s = 0;
		while(i){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	Tp summod(size_type i, Tp mod) const{
		Tp s = 0;
		while(i){
			s = (s + bit[i]) % mod;
			i -= i & -i;
		}
		if(s < 0){ s += mod; }
		return s;
	}
	void add(size_type i, Tp x){
		size_type sz = bit.size();
		while(i < sz){
			bit[i] += x;
			i += i & -i;
		}
	}
	void addmod(size_type i, Tp x, Tp mod){
		size_type sz = bit.size();
		x %= mod;
		if(x < 0){ x += mod; }
		while(i < sz){
			bit[i] = (bit[i] + x) % mod;
			i += i & -i;
		}
	}
	void clear(){
		bit.clear();
	}
	void swap(fenwick_tree &f){
		bit.swap(f.bit);
	}
	size_type lower_bound(Tp x) const{
		if(bit.empty()){ return 0; }
		size_type n = bit.size() - 1;
		size_type t = n;
		while(t & (t - 1)){
			t ^= t & -t;
		}
		size_type ans = 0;
		Tp s = Tp();
		for(; t; t >>= 1){
			size_type tmp = ans | t;
			if(tmp <= n && s + bit[tmp] < x){
				s += bit[tmp];
				ans = tmp;
			}
		}
		return ans + 1;
	}
	size_type upper_bound(Tp x) const{
		if(bit.empty()){ return 0; }
		size_type n = bit.size() - 1;
		size_type t = n;
		while(t & (t - 1)){
			t ^= t & -t;
		}
		size_type ans = 0;
		Tp s = Tp();
		for(; t; t >>= 1){
			size_type tmp = ans | t;
			if(tmp <= n && s + bit[tmp] <= x){
				s += bit[tmp];
				ans = tmp;
			}
		}
		return ans + 1;
	}
};

void mainmain(){
	int n;
	LL k;
	scanf("%d%lld", &n, &k);
	vector<LL> acc(n + 1);
	for(int i = 0; i < n; ++i){
		LL a;
		scanf("%lld", &a);
		acc[i + 1] = acc[i] + a - k;
	}

	vector<LL> st = acc;
	sort(ALL(st));

	fenwick_tree<LL> fw(n + 7);
	LL ans = 0;
	for(int i = n; i > 0; --i){
		int t = lower_bound(ALL(st), acc[i]) - st.begin() + 2;
		int u = lower_bound(ALL(st), acc[i - 1]) - st.begin() + 2;
		fw.add(t, 1);
		ans += (n - i + 1) - fw.sum(u - 1);
	}
	
	printf("%lld\n", ans);
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 4992