// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
import std.datetime, std.bigint;

immutable long inf = 10L^^16L;

int n, k;
int[] a;

void main() {
    scan(n, k);
    a = iota(n).map!(i => readln.chomp.to!int).array;
    a[] -= k;

    auto ac = new long[](n + 1);
    iota(n).each!(i => ac[i + 1] = ac[i] + a[i]);

    auto acc = compress(n + 1, ac.dup);

    debug {
        writeln("ac:", ac);
        writeln("acc:", acc);
    }

    auto ft = FenwickTree(n + 1);

    long ans;

    foreach (i ; 0 .. n + 1) {
        ans += ft.psum(acc[i]);
        ft.add(acc[i], 1);
    }

    writeln(ans);
}

auto compress(int n, long[] a) {
    auto res = new int[](n);
    auto idx = iota(n).array;

    sort(zip(a, idx));

    int num = 0;
    long p = -inf;

    foreach (i ; 0 .. n) {
        if (a[i] != p) num++;
        res[idx[i]] = num;
        p = a[i];
    }

    return res;
}

struct FenwickTree {
    private {
        int n;
        int[] data;
    }

    this(int N) {
        this.n = N;
        data = new int[](n + 1);
    }

    void add(int i, int x) {
        while (i <= n) {
            data[i] += x;
            i += i & (-i);
        }
    }

    int psum(int i) {
        return i > 0 ? psum(i - (i & (-i))) + data[i] : 0;
    }
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}