// Slower C++ solution:
#include <iostream>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<queue>

#include<algorithm>

#define N 200500

#define LL long long

#define mem(a,b) memset(a,b,sizeof(a));

using namespace std;

LL sum[N],t[N];

LL tree[N];

int n,k,a,m,nn;

void add(int x)

{

    while(x<=nn)//nn为上限，要大于离散化后的最大的数字，

    {

        tree[x]++;

        x+=x&-x;//向上更新，树状数组核心代码。此处就不解释了，不会的先学树状数组。

    }

}

LL query(int x)

{

    LL num=0;

    while(x)

    {

        num+=tree[x];

        x-=x&-x;//向下求和

    }

    return num;

}

int main()

{

    mem(t,0);

    mem(tree,0);

    mem(sum,0);

    scanf("%d%d",&n,&k);

    nn=n+10;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a);

        t[i]=sum[i]=sum[i-1]+a-k;//预处理出sum[i]数组（就是上面讲解的num数组）

    }//t[i]数组为离散化的辅助数组

    sort(t,t+n+1);//排序，排n+1个数字的序（包括了sum[0]）

    m=unique(t,t+n+1)-t;//去重

    for(int i=0; i<=n; i++)

        sum[i]=lower_bound(t,t+m+1,sum[i])-t+1;//离散化

    LL ans=0;

    for(int i=0;i<=n;i++)

    {

        ans+=query(sum[i]);//查询有多少个小于sum[i]的数字

        add(sum[i]);//更新树桩数组。

    }

    printf("%lld\n",ans);

}


// Faster C++ solution for the same problem (measured speedup: 5.981048155967981x):
#include<iostream>

#include<cstring>

#include<sstream>

#include<string>

#include<cstdio>

#include<cctype>

#include<vector>

#include<queue>

#include<cmath>

#include<stack>

#include<list>

#include<set>

#include<map>

#include<algorithm>

#define fi first

#define se second

#define MP make_pair

#define P pair<int,int>

#define PLL pair<ll,ll>

#define Sca(x) scanf("%d",&x)

#define Sca2(x,y) scanf("%d%d",&x,&y)

#define Sca3(x,y,z) scanf("%d%d%d",&x,&y,&z)

#define Scl(x) scanf("%lld",&x)

#define Scl2(x,y) scanf("%lld%lld",&x,&y)

#define Scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)

#define Pri(x) printf("%d\n",x)

#define Prl(x) printf("%lld\n",x)

#define For(i,x,y) for(int i=x;i<=y;i++)

#define _For(i,x,y) for(int i=x;i>=y;i--)

#define FAST_IO std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define ll long long

const int INF=0x3f3f3f3f;

const ll INFL=0x3f3f3f3f3f3f3f3f;

const double Pi = acos(-1.0);

using namespace std;

template <class T>void tomax(T&a,T b){ a=max(a,b); }  

template <class T>void tomin(T&a,T b){ a=min(a,b); }

const int N=2e5+5;

struct Segt{

	#define lc (p<<1)

	#define rc (p<<1|1)

	#define MID (tree[p].l+tree[p].r)>>1

	struct Tree{

		int l,r;

		ll val;

	}tree[N<<2|1];

	void pushdown(int p){ tree[p].val=tree[lc].val+tree[rc].val; }

	void build(int l,int r,int p){

		tree[p]=Tree{l,r,0};

		if(l==r) return ;

		int mid=MID;

		if(l<=mid) build(l,mid,lc);

		if(r>mid) build(mid+1,r,rc); 

	}

	void updata(int pos,int p){

		if(tree[p].l==pos && tree[p].r==pos){

			tree[p].val++;

			return ;

		}

		int mid=MID;

		if(pos<=mid) updata(pos,lc);

		if(pos>mid) updata(pos,rc);

		pushdown(p); 

	}

	ll getans(int l,int r,int p){

		if(l>r) return 0;

		if(tree[p].l>=l&&tree[p].r<=r) return tree[p].val;

		ll ans=0;

		int mid=MID;

		if(l<=mid) ans+=getans(l,r,lc);

		if(r>mid) ans+=getans(l,r,rc);

		return ans;

	}

}t;

ll tmp[N],sum[N];

int dispersed(int n){

	sort(tmp,tmp+1+n);

	return unique(tmp,tmp+1+n)-tmp;

}

int main(){

	int n,k; Sca2(n,k);

	For(i,1,n){

		int x; Sca(x);

		tmp[i]=sum[i]=sum[i-1]+x-k;

	}

	int len=dispersed(n);

	For(i,0,n){

		sum[i]=lower_bound(tmp,tmp+len,sum[i]) - tmp + 1;

	}

	t.build(1,n+1,1);

	ll ans=0;

	For(i,0,n){

		ans+=t.getans(1,sum[i],1);

		t.updata(sum[i],1);

	}

	Prl(ans);

}