#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define maxn 100010
using namespace std;
typedef long long ll;
int n,k;
ll sans[maxn];
int lowbit(int x)
{
    return x&(-x);
}
void upd(int x,int t)
{
    while(x<=n)
    {
        sans[x]+=t;
        x+=lowbit(x);
    }
}
ll sum(ll x)
{
    ll ans=0;
    while(x>0)
    {
        ans+=sans[x];
        x-=lowbit(x);
    }
    return ans;
}


int main()
{
    scanf("%d%d",&n,&k);
    int a;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a);
        upd(i,a);
    }
    ll ans=0;
    for(ll l=0;l<=n;l++)
    {
        for(ll i=1;i+l<=n;i++)
        {
            ll j=i+l;
            if(sum(j)-sum(i-1)>=(l+1)*k)ans++;
        }
    }
    printf("%I64d\n",ans);
    return 0;
}
