#include <bits/stdc++.h>
using namespace std;
const int size=1e6+10;
const int INF=1e9;
int tree[size];
int a[size];
int b[size];
typedef long long LL;
int lowbit(int x)
{
    return x&(-x);
}
void update(int x)
{
    while(x<size)
    {
        tree[x]+=1;
        x+=lowbit(x);
    }
}
int ask(int x)
{
    int sum=0;
    while(x)
    {
       sum+=tree[x];
       x-=lowbit(x);
    }
    return sum;
}
int main()
{
   int n,p;
//   scanf("%d",&T);
   while(scanf("%d%d",&n,&p)!=EOF)
   {
       memset(tree,0,sizeof(tree));
       LL ans=0;
     for(int i=1;i<=n;i++) scanf("%d",&b[i]);
     for(int i=1;i<=n;i++)
     {
         b[i]-=p;
         b[i]=b[i]+b[i-1];   if(b[i]>=0) ans++;
         a[i-1]=b[i];

     }
     sort(a,a+n);
     int cnt=unique(a,a+n)-a;
     int temp=lower_bound(a,a+cnt,b[1])-a+2+n;;
     update(temp);
     for(int i=2;i<=n;i++)
     {
          temp=lower_bound(a,a+cnt,b[i])-a+2+n;
          ans+=ask(temp);
          update(temp);
     }
     printf("%lld\n",ans);
   }
}
