#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


#define MAX 200001
ll a[MAX], hs[MAX], c[MAX];

int ask(int x) {
    int t = 0;
    for(; x; x-=x&-x) t += c[x];
    return t;
}

void add(int x, int N) {
    for(; x<MAX; x+=x&-x) c[x]++;
}

int main(void) {
    int N, K;
    scanf("%d%d", &N, &K);
    a[0] = hs[0] = 0;
    for(int i=1; i<=N; i++) {
        scanf("%d", a+i);
        hs[i] = a[i] += a[i-1] - K; 
        
    }
    sort(hs, hs+N+1);
    for(int i=0; i<=N; i++) a[i] = lower_bound(hs, hs+N+1, a[i]) - hs + 1;
    ll ans = 0;
    for(int i=0; i<=N; i++) {
        ans += ask(a[i]);
        add(a[i], N);
    }

    return !printf("%lld\n", ans);
}