#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
 
using namespace std;
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);

struct node
{
    ll x, y;
    node *L, *R;
    ll sz;
    node() {}
    node(ll x, ll y)
    {
        this->x = x;
        this->y = y;
        L = NULL;
        R = NULL;
        sz = 1;
    }
};

ll get_sz(node* t)
{
    if (t == NULL)
        return 0;
    else
        return t->sz;
}

void upd_sz(node* t)
{
    if (t == NULL)
        return;
    else
        t->sz = get_sz(t->L) + get_sz(t->R) + 1;
}

bool exist(node* t, ll x)
{
    if (t == NULL)
        return false;
    else if (t->x == x)
        return true;
    else if (x < t->x)
        return exist(t->L, x);
    else
        return exist(t->R, x);
}

pair<node*, node*> split(node* t, ll x)
{
    if (t == NULL)
        return {NULL, NULL};
    else if (x <= t->x)
    {
        auto p = split(t->L, x);
        t->L = p.se;
        p.se = t;
        upd_sz(p.fi); upd_sz(p.se);
        return p;
    }
    else
    {
        auto p = split(t->R, x);
        t->R = p.fi;
        p.fi = t;
        upd_sz(p.fi); upd_sz(p.se);
        return p;
    }
}

node* merge(node* l, node* r)
{
    if (l == NULL)
        return r;
    else if (r == NULL)
        return l;
    else if (l->y <= r->y)
    {
        l->R = merge(l->R, r);
        upd_sz(l);
        return l;
    }
    else
    {
        r->L = merge(l, r->L);
        upd_sz(r);
        return r;
    }
}

node* add(node* t, ll x, ll y)
{
    node* _new = new node(x, y);
    auto p = split(t, x);
    return merge(merge(p.fi, _new), p.se);
}

node* del(node* t, ll x)
{
    auto p = split(t, x);
    auto p1 = split(p.se, x + 1);
    return merge(p.fi, p1.se);
}

ll next(node* t, ll x)
{
    if (t->x <= x && t->R == NULL)
        return inf;
    else if (t->x <= x)
        return next(t->R, x);
    else if (t->L != NULL)
        return min(next(t->L, x), t->x);
    else
        return t->x;
}

ll prev(node* t, ll x)
{
    if (t->x >= x && t->L == NULL)
        return -inf;
    else if (t->x >= x)
        return prev(t->L, x);
    else if (t->R != NULL)
        return max(prev(t->R, x), t->x);
    else
        return t->x;
}

ll kth(node* t, ll k)
{
    if (get_sz(t->L) == k)
        return t->x;
    else if (get_sz(t->L) > k)
        return kth(t->L, k);
    else
        return kth(t->R, k - get_sz(t->L) - 1);
}

ll get_cnt(node* t, ll l, ll r)
{
    auto p = split(t, l);
    auto p1 = split(p.se, r);
    ll cnt = get_sz(p1.fi);
    t = merge(p.fi, merge(p1.fi, p1.se));
    return cnt;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n, k;
    cin >> n >> k;
    ll a[n];
    rep(i, 0, n)
    {
        cin >> a[i];
        a[i] -= k;
    }
    ll ans = 0;
    node* DD = NULL;
    DD = add(DD, 0, rand() << 15 | rand());
    ll sum = 0;
    rep(i, 0, n)
    {
        sum += a[i];
        ans += get_cnt(DD, -big, sum + 1);
        DD = add(DD, sum, rand() << 15 | rand());
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264