#line 1 "test/aoj/3117.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3117"

#include <iostream>
#include <cstdio>
#include <cfloat>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <algorithm>
#line 1 "bbst/merge_split_set_treap.hpp"



#line 5 "bbst/merge_split_set_treap.hpp"
#include <cstdint>
#include <random>
#line 8 "bbst/merge_split_set_treap.hpp"
#include <cassert>
#include <memory>
#include <utility>

//===
template <class T, class Compare = std::less<T>,
          template<class> class Alloc = std::allocator>
struct Treap {
    using uint = uint_fast32_t;
    using uint64 = uint_fast64_t;
    struct Node;
    using pn = std::pair<Node *, Node *>;
    
    struct Node {
        T dat;
        uint64 p;

        uint sz = 1;
        Node *lch;
        Node *rch;

        Node(T dat, uint64 p):
            dat(dat), p(p), lch(nullptr), rch(nullptr) {}
    };
    
    Node *root;
    const Compare cmp;
    std::mt19937 rnd;
    
    Alloc<Node> alc;
    using Traits = std::allocator_traits<Alloc<Node> >;
    
    Treap(const Compare &cmp = Compare()):
        root(nullptr), cmp(cmp), rnd(std::mt19937(std::random_device()())) {};
    
    void clear(Node *u) {
        if (u == nullptr) return;
        clear(u->lch);
        clear(u->rch);
        Traits::deallocate(alc, u, 1);
    };
    ~Treap() {
        clear(root);
    };

    int size() {
        return size(root);
    }
    int size(Node *u) {
        if (u == nullptr) return 0;
        else return u->sz;
    };
    void update(Node *u) {
        u->sz = size(u->lch) + size(u->rch) + 1;
    };
    Node *merge(Node *l, Node *r) {
        if (l == nullptr) return r;
        if (r == nullptr) return l;

        if (l->p > r->p) {
            l->rch = merge(l->rch, r);
            update(l);
            return l;
        }
        else {
            r->lch = merge(l, r->lch);
            update(r);
            return r;
        }
    };
    pn split(Node *t, T dat) { // first->dat <= dat, dat < second->dat
        if (t == nullptr) return std::make_pair(nullptr, nullptr);
        if (cmp(dat, t->dat)) {
            pn s = split(t->lch, dat);
            t->lch = s.second;
            update(t);
            return std::make_pair(s.first, t);
        }
        else {
            pn s = split(t->rch, dat);
            t->rch = s.first;
            update(t);
            return std::make_pair(t, s.second);
        }
    };
    
    bool find(T dat) {
        Node *u = root;
        while (u != nullptr && (cmp(u->dat, dat) || cmp(dat, u->dat))) {
            if (cmp(dat, u->dat)) u = u->lch;
            else u = u->rch;
        }
        return u == nullptr;
    };

    void insert(T dat) {
        Node *u = Traits::allocate(alc, 1);
        Traits::construct(alc, u, dat, (uint64)rnd());
        pn t = split(root, dat);
        root = merge(t.first, merge(u, t.second));
    };
    void erase(T dat) {
        assert(find(dat));
        pn t = split(root, dat);
        erase_rightist(t.first);
        root = merge(t.first, t.second);
    };
    Node *erase_rightist(Node *u) {
        if (u.rch == nullptr) {
            Node *ret = u.lch;
            Traits::deallocate(alc, u, 1);
            return ret;
        }
        u->rch = erase_rightist(u->rch);
        update(u);
        return u;
    }

    int order_of(T x) {
        Node *u = root;
        int k = 0;
        while (u != nullptr && (cmp(u->dat, x) || cmp(x, u->dat))) {
            if (cmp(x, u->dat)) {
                u = u->lch;
            }
            else {
                k = k + size(u->lch) + 1;
                u = u->rch;
            }
        }

        if (u == nullptr) return -1;
        k += size(u->lch);
        return k;
    };
    T find_Kth_element(uint k) {
        assert(k < size());
        Node *u = root;
        while (k > 0) {
            if (size(u->lch) == k) return u->dat;
            if (size(u->lch) + 1 <= k) {
                k -= size(u->lch) + 1;
                u = u->rch;
            }
            else {
                u = u->lch;
            }
        }

        return u->dat;
    };
};
//===


#line 16 "test/aoj/3117.test.cpp"

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

llong n, k;
Treap<P> st;

int main() {
    cin >> n >> k;

    llong csum = 0;
    llong ans = 0;
    st.insert({0, -1});
    for (int i = 0; i < n; i++) {
        llong a;
        cin >> a;
        a -= k;
        csum += a;
        st.insert({csum, i});
        ans += st.order_of({csum, i});
    }
    cout << ans << endl;

    return 0;
};




Measured memory_bytes: 9412