#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;

map<int, int> ma;
const int MAXN = 200005, MAXM = 800005;
struct node{
    int l, r, sum;
}tree[MAXM];
int ans;
int a[MAXN], b[MAXN];

void pushup(int q){
    tree[q].sum = tree[q << 1].sum + tree[q << 1 | 1].sum;
}

void build(int q, int l, int r){
    tree[q].l = l;
    tree[q].r = r;
    if(l == r){
        tree[q].sum = 0;
        return;
    }
    int mid = (l + r) >> 1;
    build(q << 1, l, mid);
    build(q << 1 | 1, mid + 1, r);
    pushup(q);
}

void update(int q, int x, int y){
    if(tree[q].l > x || tree[q].r < x) return;
    if(tree[q].l == x && tree[q].r == x){
        tree[q].sum += y;
        return;
    }
    update(q << 1, x, y);
    update(q << 1 | 1, x, y);
    pushup(q);
}

void query(int q, int l, int r){
    if(tree[q].l > r || tree[q].r < l) return;
    if(tree[q].l >= l && tree[q].r <= r){
        ans += tree[q].sum;
        return;
    }
    query(q << 1, l, r);
    query(q << 1 | 1, l, r);
}

int main(){
    int n, k, m = 0;
    scanf("%d%d", &n, &k);
    int res = 0;
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        a[i] -= k; a[i] += a[i - 1];
        b[i] = a[i];
    }
    sort(b + 1, b + n + 1);
    for(int i = 1; i <= n; i++)
        if(ma.find(b[i]) == ma.end()) ma[b[i]] = ++m;
    build(1, 0, m);
    for(int i = 0; i <= n; i++){
        ans = 0;
        query(1, 0, ma[a[i]]);
        res += ans;
        update(1, ma[a[i]], 1);
    }
    printf("%d\n", res);
    return 0;
}