// 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.789994810527809x):
#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);





}