#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ccomplex>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>


#define SZ(X) ((X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (LL I = 0; I < N; ++I)
#define REPP(I, A, B) for (LL I = (A); I < (B); ++I)
#define RI(X) scanf("%lld", &(X))
#define RII(X, Y) scanf("%lld%lld", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define DRI(X) LL (X); scanf("%lld", &X)
#define DRII(X, Y) LL X, Y; scanf("%lld%lld", &X, &Y)
#define DRIII(X, Y, Z) LL X, Y, Z; scanf("%lld%lld%lld", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define IO(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
typedef long long LL;
typedef unsigned long long ull;
using namespace std;

template<typename T>
class treap{
private:
    struct node{
        T data;
        unsigned fix;
        int s;
        node *ch[2];
        node(const T&d):data(d),s(1){}
        node():s(0){ch[0]=ch[1]=this;}
    }*nil,*root;
    unsigned x;
    unsigned ran(){return x=x*0xdefaced+1;}
    void rotate(node *&a,bool d){
        node *b=a;
        a=a->ch[!d];
        a->s=b->s;
        b->ch[!d]=a->ch[d];
        a->ch[d]=b;
        b->s=b->ch[0]->s+b->ch[1]->s+1;
    }
    void insert(node *&o,const T &data){
        if(!o->s){
            o=new node(data),o->fix=ran();
            o->ch[0]=o->ch[1]=nil;
        }else{
            o->s++;
            bool d=o->data<data;
            insert(o->ch[d],data);
            if(o->ch[d]->fix>o->fix)rotate(o,!d);
        }
    }
    node *merge(node *a,node *b){
        if(!a->s||!b->s)return a->s?a:b;
        if(a->fix>b->fix){
            a->ch[1]=merge(a->ch[1],b);
            a->s=a->ch[0]->s+a->ch[1]->s+1;
            return a;
        }else{
            b->ch[0]=merge(a,b->ch[0]);
            b->s=b->ch[0]->s+b->ch[1]->s+1;
            return b;
        }
    }
    bool erase(node *&o,const T &data){
        if(!o->s)return 0;
        if(o->data==data){
            node *t=o;
            o=merge(o->ch[0],o->ch[1]);
            delete t;
            return 1;
        }
        if(erase(o->ch[o->data<data],data)){
            o->s--;return 1;
        }else return 0;
    }
    void clear(node *&o){
        if(o->s)clear(o->ch[0]),clear(o->ch[1]),delete o;
    }
public:
    treap(unsigned s=20150119):nil(new node),root(nil),x(s){}
    ~treap(){clear(root),delete nil;}
    void clear(){clear(root),root=nil;}
    void insert(const T &data){
        insert(root,data);
    }
    bool erase(const T &data){
        return erase(root,data);
    }
    bool find(const T&data){
        for(node *o=root;o->s;)
            if(o->data==data)return 1;
            else o=o->ch[o->data<data];
        return 0;
    }
    int rank(const T&data){
        int cnt=0;
        for(node *o=root;o->s;)
            if(o->data<data)cnt+=o->ch[0]->s+1,o=o->ch[1];
            else o=o->ch[0];
        return cnt;
    }
    const T&kth(int k){
        for(node *o=root;;)
            if(k<=o->ch[0]->s)o=o->ch[0];
            else if(k==o->ch[0]->s+1)return o->data;
            else k-=o->ch[0]->s+1,o=o->ch[1];
    }
    const T&operator[](int k){
        return kth(k);
    }
    const T&preorder(const T&data){
        node *x=root,*y=0;
        while(x->s)
            if(x->data<data)y=x,x=x->ch[1];
            else x=x->ch[0];
        if(y)return y->data;
        return data;
    }
    const T&successor(const T&data){
        node *x=root,*y=0;
        while(x->s)
            if(data<x->data)y=x,x=x->ch[0];
            else x=x->ch[1];
        if(y)return y->data;
        return data;
    }
    int size(){return root->s;}
};
LL A[200010],pre[200010];
int main(){
    DRII(N,K);
    REPP(i,1,1+N){
        RI(A[i]);A[i]-=K;
    }
    pre[0]=0;
    REPP(i,1,1+N)pre[i]=pre[i-1]+A[i];
    treap<LL> TT;
    TT.insert(0);
    LL ans=0;
    REPP(i,1,1+N){
        ans+=TT.rank(pre[i]+1);
        TT.insert(pre[i]);
    }printf("%lld\n",ans);
}


Measured memory_bytes: 12800