#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN=200005;

int n,k;
long long a[MAXN];

int lowbit(int x)
{
    return (x&-x);
}

void modify(int x,int num)
{
    while(x<=n){
        a[x]+=(long long)num;
        x+=lowbit(x);
    }
}

long long sum(int x)
{
    long long ans=0;
    while(x>0){
        ans+=a[x];
        x-=lowbit(x);
    }
    return ans;
}

int main()
{
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        modify(i,x);
    }
    long long cnt=0;
    for(int i=n;i>=1;i--){
        for(int j=i;j<=n;j++){
            long long tot=sum(j)-sum(i-1);
            if(tot/(j-i+1)>=(long long)k)cnt++;
        }
    }
    printf("%lld\n",cnt);
    return 0;
}
