#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
template<class T> class treap { //WARNING!! 0-indexed
public:
    struct node {
        T val, sum;
        node *left, *right;
        int pri;
        unsigned sz;
        node(T val, int pri):val(val),sum(val),pri(pri),sz(1) {
            left = right = NULL;
        }
    };

    node *root;
    treap() : root(NULL) {
        srand(time(NULL));
    }
        
    unsigned size() { return size(root); }
    unsigned size(node *v) { return !v? 0: v->sz; }
    T sum(node *v) { return !v? 0: v->sum; }

    node *update(node *v) {
        if(v == NULL) return v;
        v->sz = size(v->left)+size(v->right)+1;
        v->sum = sum(v->left)+sum(v->right)+v->val;
        return v;
    }

    node *merge(node *s, node *t) {
        if(!s or !t) return s? s: t;
        if(s->pri > t->pri) {
            s->right = merge(s->right, t);
            return update(s);
        }
        t->left = merge(s, t->left);
        return update(t);
    }

    pair<node*, node*> split(node *v, unsigned k) {
        if(!v) return pair<node*,node*>(NULL,NULL);
        if(k <= size(v->left)) {
            pair<node*,node*> s = split(v->left, k);
            v->left = s.second;
            return make_pair(s.first,update(v));
        }
        pair<node*, node*> s = split(v->right, k-size(v->left)-1);
        v->right = s.first;
        return make_pair(update(v),s.second);
    }

    node *find(unsigned k) {
        node *v = root;
        while(v) {
            unsigned s = size(v->left);
            if(s > k) v = v->left;
            else if(s == k) return v;
            else {
                v = v->right;
                k -= s+1;
            }
        }
        return v;
    }

    void insert(unsigned k, T val) { root = insert(root,k,val,rand()); }
    node *insert(node *t, unsigned k, T val, int pri) {
        pair<node*, node*> s = split(t,k);
        t = merge(s.first, new node(val,pri));
        t = merge(t, s.second);
        return update(t);
    }

    void insert(T val){
        insert(this->upperBound(val), val);
        return;
    }

    void erase(int k) { root = erase(root,k); }
    node *erase(node *t, unsigned k) {
        pair<node*, node*> u, v;
        u = split(t,k+1);
        v = split(u.first, k);
        t = merge(v.first, u.second);
        return update(t);
    }

    inline int lowerBound(node *t, T val){
        t = update(t);
        if(!t) return 0;
        if(val <= t->val) return lowerBound(t->left, val);
        return size(t->left) + lowerBound(t->right, val) + 1;
    }

    inline int lowerBound(T val){
        return this->lowerBound(this->root, val);
    }

    inline int upperBound(node *t, T val){
        t = update(t);
        if(!t) return 0;
        if(val < t->val) return upperBound(t->left, val);
        return size(t->left) + upperBound(t->right, val) + 1;
    }

    inline int upperBound(T val){
        return this->upperBound(this->root, val);
    }

    inline int count(T val){
        return upperBound(val) - lowerBound(val);
    }

    inline T get(unsigned k){
        return this->find(k)->val;
    }
};


int main() {
    //cout.precision(10);
    int n;
    ll k;
    cin >> n >> k;
    ll a[200050];
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        a[i] -= k;
    }
    treap<ll> tre;
    tre.insert(0);
    ll ans = 0;
    ll sum = 0;
    for(int i = 1; i <= n; i++){
        //cout << "a" << endl;
        ans += (i - tre.lowerBound(-a[i] - sum));
        //cout << i << " " << a[i] << " " << i - tre.lowerBound(-a[i] - sum) << endl;
        sum += a[i];
        tre.insert(-sum);        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136