#include <bits/stdc++.h>

//_ ************************** Advanced PBDS ***********************************
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<class T>
using ordered_set = tree<
    T,
    null_type,
    less<T>,
    rb_tree_tag,
    tree_order_statistics_node_update
>;
 
 
//_ ****************************************************************************
 
#define int              long long int
#define double           long double
#define print(a)         for(auto x : a) cout << x << " "; cout << endl


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;

inline int power(int a, int b, int mod=M) {
    int x = 1;
    a %= mod;
    while (b) {
        if (b & 1) x = (x * a) % mod; 
        a = (a * a) % mod;
        b >>= 1;
    }
    return x;
}


//_ ***************************** START Below *******************************

// 5 4
// 3 4 5 6 2


vector<int> a;

int consistency(int n, int k){
	
	
	ordered_set<pair<int,int>> st;
	st.insert({k, -1});
	
	int ans = 0;
	int sum = 0;
	
	for(int i=0; i<n; i++){
		sum += a[i];
		int val = sum - i*k;
		
		ans += st.order_of_key({val, LINF});
		
		st.insert({val, i});
		
	}
	
	return ans;
}















int practice(int n, int k){


    return 0;
}





void solve() {
    
    int n, k;
    cin>> n >> k;
    
    a.resize(n);
    for(int i=0; i<n; i++) cin >> a[i];
    
    cout << consistency(n, k) << endl;


}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}