#include<set>
#include<map>
#include<ctime>
#include<cstdio>
#include<queue>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
const double eps=1e-8;
const int maxn=1e6+10;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
LL a[maxn],b[maxn];
int sum[maxn];
int low_bit(int x)
{
    return x&(-x);
}
void add(int x)
{
    while(x<maxn)
    {
        sum[x]++;
        x+=low_bit(x);
    }
}
int get_ans(int x)
{
    int ans=0;
    while(x)
    {
        ans+=sum[x];
        x-=low_bit(x);
    }
    return ans;
}
int main()
{
    int n,k;
    while(~scanf("%d%d",&n,&k))
    {
        int he=0;
        memset(sum,0,sizeof(sum));
        for(int i=0;i<n;i++)
        {
            scanf("%lld",&a[i]);
            a[i]-=k;
            if(a[i]>=0) he++;
        }
        b[1]=a[0];
        b[n+1]=0;
        for(int i=1;i<n;i++)
        {
            a[i]+=a[i-1];
            b[i+1]=a[i];
        }
        sort(b+1,b+n+2);
        add(lower_bound(b+1,b+n+2,0)-b);
        LL ans=0;
//        for(int i=1;i<=n+1;i++)
//            printf("b[%d]=%lld\n",i,b[i]);
        for(int i=0;i<n;i++)
        {
            int k=lower_bound(b+1,b+n+2,a[i])-b;
            ans+=get_ans(k);//printf("k=%d ans=%lld a[%d]=%lld\n",k,ans,i,a[i]);
            add(k);
        }
        printf("%lld\n",ans);
    }
}
