#include<iostream>
#include<cstdio>
#include<set>
#include<algorithm>
#include<queue>
using namespace std;
const int N=2e5+5;
int a[N];
typedef long long ll;
int K,n;
ll de[N];
ll ans;
void ini(int,int);
int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    ini(1,n);
    printf("%lld",ans);
}
void ini(int s,int e){
    if(s==e){
        ans+=a[s]>=K;
        return;
    }
    int mid=(s+e)/2;
    ini(s,mid),ini(mid+1,e);
    int top=0;
    ll sum=0;
    for(int i=mid;i>=s;i--){
        sum+=a[i];
        de[top++]=-sum+1LL*K*(mid-i+1);
    }
    sort(de,de+top);
    sum=0;
    for(int i=mid+1;i<=e;i++){
        sum+=a[i];
        int t=upper_bound(de,de+top,sum-1LL*K*(i-mid))-de;
        ans+=max(0,t);
    }
}
