#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
#define N 200100
#define LL long long

LL s[N],n,m,d[N],sum[N*4];
map<LL,int>mp;
int tmp;

void add(int x)
{
    while(x < N)
    {
        sum[x]++;
        x += (x & -x);
    }
}

LL get(int x)
{
    LL su = 0;
    while(x > 0)
    {
        su += sum[x];
        x -= (x & -x);
    }
    return su;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> m;
    LL x;
    for(int i=1;i<=n;i++)
    {
        cin >> x;
        x -= m;
        s[i] = s[i-1] + x;
        d[i] = s[i];
    }
    sort(d,d+1+n);
    mp.clear();
    tmp = 0;
    for(int i=0;i<=n;i++)
     if(!mp[d[i]])
         mp[d[i]] = ++tmp;
    LL ans = 0;
    for(int i=0;i<=n;i++)
    {
        ans += get(mp[s[i]]);
        add(mp[s[i]]);
    }
    cout << ans << endl;
    return 0;
}
