#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 10;

typedef long long ll;

ll p[maxn];
ll a[maxn],b[maxn];
map<ll,int> m;
ll lowbit(ll x) {return x & -x;};

ll sum(ll x) {
    ll res = 0;
    while (x > 0) {
        res += p[x];
        x -= lowbit(x);
    }
    return res;
}

void add(ll x) {
    while (x < maxn) {
        p[x]++;
        x += lowbit(x);
    }
}

int main() {
    int n,k; cin>>n>>k;
    for (int i = 1; i <= n; i++) {
        cin>>a[i];
        a[i] += a[i - 1] - k;
        b[i] = a[i];
    }
    sort(b, b + n + 1);
    int len = 1;
    for (int i = 0; i <= n; i++) {
        if (m[b[i]]) continue;
        m[b[i]] = len++;
    }
    ll res = 0;
    for (int i = 0; i <= n; i++) {
        ll t = m[a[i]];
        res += sum(t);
        add(t);
    }
    cout<<res<<endl;


    return 0;
}
