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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int sign(int x) { return (x > 0) - (x < 0); }
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int cdiv(int a, int b) { return (a - 1 + b) / b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const deque<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const set<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename M>
struct splay_tree {
    using T = typename M::T;
    struct node {
        node *left, *right, *par;
        int size;
        T val, res;
        node(T val) : left(nullptr), right(nullptr), par(nullptr), size(1), val(val), res(val) {}
        void rotate() {
            node *p, *pp, *c;
            p = par, pp = p->par;
            if (p->left == this) { c = right, right = p, p->left = c; }
            else { c = left, left = p, p->right = c; }
            if (pp) {
                if (pp->left == p) { pp->left = this; }
                else { pp->right = this; }
            }
            if (c) { c->par = p; }
            par = pp, p->par = this;
            p->update();
            update();
        }
        int state() {
            if (!par) { return 0; }
            if (par->left == this) { return 1; }
            else { return -1; }
        }
        void splay() {
            while (state() != 0) {
                if (par->state() == 0) { rotate(); }
                else if (state() == par->state()) { par->rotate(), rotate(); }
                else { rotate(), rotate(); }
            }
        }
        void update() {
            size = 1, res = val;
            if (left) { size += left->size, res = M::op(left->res, res); }
            if (right) { size += right->size, res = M::op(res, right->res); }
        }
    };
    node *root;
    splay_tree(node *root = nullptr) : root(root) {}
    int size() {
        if (!root) { return 0; }
        return root->size;
    }
    node *get_node(int idx) {
        node *cur = root;
        while (true) {
            int size_l = cur->left ? cur->left->size : 0;
            if (idx < size_l) { cur = cur->left; }
            if (idx == size_l) {
                cur->splay();
                return root = cur;
            }
            if (idx > size_l) { cur = cur->right, idx -= size_l + 1; }
        }
    }
    T get(int idx) { return get_node(idx)->val; }
    int lower_bound(T x) {
        if (!root) { return 0; }
        node *cur = root;
        int ret = -1;
        while (true) {
            if (cur->state() < 1) { ret += cur->left ? cur->left->size + 1 : 1; }
            else { ret -= cur->right ? cur->right->size + 1 : 1; }
            if (M::gr(x, cur->val)) {
                if (cur->right) { cur = cur->right; }
                else {
                    cur->splay(), root = cur;
                    return ret + 1;
                }
            } else {
                if (cur->left) { cur = cur->left; }
                else {
                    cur->splay(), root = cur;
                    return ret;
                }
            }
        }
    }
    splay_tree split(int size_left) {
        if (size_left == 0) {
            node *root_r = root;
            root = nullptr;
            return root_r;
        }
        if (size_left == root->size) { return nullptr; }
        node *root_r = get_node(size_left);
        root = root_r->left;
        root_r->left = nullptr, root->par = nullptr;
        root_r->update();
        return root_r;
    }
    void merge(splay_tree right) {
        if (!root) {
            root = right.root;
            return;
        }
        if (!right.root) { return; }
        get_node(root->size - 1);
        root->right = right.root, right.root->par = root;
        root->update();
    }
    void insert(int idx, T x) {
        splay_tree xt = new node(x), right = split(idx);
        merge(xt), merge(right);
    }
    void erase(int idx) {
        splay_tree right = split(idx).split(1);
        merge(right);
    }
    T get_sum(int l, int r) {
        splay_tree mid = split(l);
        splay_tree right = mid.split(r - l);
        T ret = mid.root->res;
        merge(mid), merge(right);
        return ret;
    }
};

struct int_st {
    using T = int;
    static T op(T a, T b) { return std::min(a, b); }
    static bool gr(const T &a, const T &b) { return a > b; }
};

signed main() {
    int N, K;
    cin >> N >> K;
    vint a(N);
    rep(i, N) { cin >> a[i], a[i] -= K; }
    vint acc(N + 1);
    rep(i, N) { acc[i + 1] = acc[i] + a[i]; }
    splay_tree<int_st> st;
    int ans = 0;
    rep(i, N + 1) {
        ans += st.lower_bound(acc[i] + 1);
        st.insert(st.lower_bound(acc[i]), acc[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 18804