// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<=(b);++i)

#define ROF(i,a,b) for (int i=(a);i>=(b);--i)

typedef long long ll;

inline int read() {

	int x=0,s=1; char ch=getchar();

	while (ch<'0'||ch>'9') { if (ch=='-') s=-1; ch=getchar(); }

	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }

	return s*x;

}



const int MAXN=200005,Mo=1000000007;

ll sum[MAXN];

int n,m,q,a[MAXN],b[MAXN],f[MAXN];

#define lowbit(x) ((x)&(-(x)))

void add(int x,int y){ for (;x<MAXN;x+=lowbit(x)) f[x]+=y; }

int getsum(int x){ int y=0; for (;x;x-=lowbit(x)) y+=f[x]; return y; }

int cmp(int i,int j){ return sum[i]<sum[j]; }

int main(){

	n=read(); m=read();

	b[0]=sum[0]=0;

	FOR(i,1,n) a[i]=read()-m,b[i]=i,sum[i]=sum[i-1]+a[i];

	sort(b,b+1+n,cmp);

	//FOR(i,0,n) printf("%lld%c",sum[i]," \n"[i==n]);

	//FOR(i,0,n) printf("%d%c",b[i]," \n"[i==n]);

	int k=1;

	FOR(i,0,n) {

		if (i&&sum[b[i]]!=sum[b[i-1]]) k++;

		a[b[i]]=k;

	}

	//FOR(i,0,n) printf("%d%c",a[i]," \n"[i==n]);

	memset(f,0,sizeof(f));

	ll ans=0;

	FOR(i,0,n) {

		ans+=getsum(a[i]);

		add(a[i],1);

	}

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

	

	return 0;

}



/*

*/


// Faster C++ solution for the same problem (measured speedup: 1.749783955796079x):
#include <bits/stdc++.h>



using namespace std;





#ifdef zxc



#include <sys/resource.h>

#include "debug.h"

#include "profile.h"



#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#define profile(X) LOG_DURATION(X)

#else

#define debug(...) 42

#define profile(...) 42

#endif



using ll = int64_t;

using ld = double;

const ld EPS = 1e-9;

const int MOD = 1e9 + 7;

const ld PI = 3.141592653589793;

const int maxn = 600001;

using cd = complex<double>;



void fast_io() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

}



struct fenwick {

    fenwick(int size) : data(size) {



    }



    void add(int pos, int val) {

        for (; pos < data.size(); pos |= pos + 1) {

            data[pos] += val;

        }

    }



    ll get(int pos) {

        ll res = 0;

        for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {

            res += data[pos];

        }

        return res;

    }



    vector<int> data;



};



signed main() {

#ifdef zxc

    struct rlimit rl;

    const rlim_t kStackSize = 512L * 1024L * 1024L;

    assert(!getrlimit(RLIMIT_STACK, &rl));

    rl.rlim_cur = kStackSize;

    assert(!setrlimit(RLIMIT_STACK, &rl));

    freopen("../input.txt", "r", stdin);

//    freopen("../kolya_output.txt", "w", stdout);

#else

    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());

    //            freopen("", "r", stdin);

    //        freopen("hack.out", "w", stdout);

#endif

    profile("all");

    auto solve = [](int _) {

        int n;

        cin >> n;

        int k;

        cin >> k;

        vector<int> a(n + 1);

        vector<ll> pref(n + 1);

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

            cin >> a[i];

            a[i] -= k;

            pref[i] = pref[i - 1] + a[i];

        }

        vector<int> p(n + 1);

        iota(p.begin(), p.end(), 0);

        sort(p.begin(), p.end(), [&](int i, int j) {

            return tie(pref[i], i) < tie(pref[j], j);

        });

        ll ans = 0;

        fenwick fwt(n + 1);

        for (int i:p) {

            ans += fwt.get(i - 1);

            fwt.add(i, 1);

        }

        cout << ans;

    };





    fast_io();



    cout.precision(9);

    cout <<

         fixed;

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

        solve(1);





}