import sys

from itertools import accumulate



def solve():

    n, k = list(map(int, sys.stdin.readline().split()))

    a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]

    s = [0] + list(accumulate(a))



    # 座標圧縮

    s = [(si, i) for (i, si) in enumerate(s)]

    s.sort()



    z = [None] * (n + 1)



    num = -1

    p = -float('inf')



    for i in range(n + 1):

        if s[i][0] > p:

            num += 1



        z[s[i][1]] = num

        p = s[i][0]



    # FenwickTreeで転倒数を数える

    ft = FenwickTree(num + 1)



    ans = 0



    for zi in z:

        ans += ft.psum(zi + 1)

        ft.add(zi, 1)



    print(ans)



class FenwickTree:

    def __init__(self, n):

        self.n = n

        self.b = [0] * (n + 1)



    def add(self, i, x):

        i += 1



        while i <= self.n:

            self.b[i] += x

            i += i & (-i)



    def psum(self, r):

        res = 0



        while r > 0:

            res += self.b[r]

            r -= r & (-r)



        return res



if __name__ == '__main__':

    solve()
import sys

from itertools import accumulate



inf = 1<<60

ans = 0



def solve():

    n, k = list(map(int, sys.stdin.readline().split()))

    a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]

    s = [0] + list(accumulate(a))



    MergeSort(s)



    print(ans)



def MergeSort(a):

    if len(a) == 1:

        return a



    apre = MergeSort(a[:len(a)//2])

    asuf = MergeSort(a[len(a)//2:])



    res = merge(apre, asuf)



    return res



def merge(a, b):

    global ans

    na = len(a)

    nb = len(b)



    a.append(-inf)

    b.append(-inf)



    la = 0

    lb = 0



    res = []



    for i in range(na + nb):

        if a[la] <= b[lb]:

            ans += na - la

            res.append(b[lb])

            lb += 1

        else:

            res.append(a[la])

            la += 1



    return res



if __name__ == '__main__':

    solve()
import sys
from itertools import accumulate


def solve():
    n, k = list(map(int, sys.stdin.readline().split()))
    a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
    s = [0] + list(accumulate(a))
    # 座標圧縮
    s = [(si, i) for (i, si) in enumerate(s)]
    s.sort()
    z = [None] * (n + 1)
    num = -1
    p = -float("inf")
    for i in range(n + 1):
        if s[i][0] > p:
            num += 1
        z[s[i][1]] = num
        p = s[i][0]
    # FenwickTreeで転倒数を数える
    ft = FenwickTree(num + 1)
    ans = 0
    for zi in z:
        ans += ft.psum(zi + 1)
        ft.add(zi, 1)
    print(ans)


class FenwickTree:
    def __init__(self, n):
        self.n = n
        self.b = [0] * (n + 1)

    def add(self, i, x):
        i += 1
        while i <= self.n:
            self.b[i] += x
            i += i & (-i)

    def psum(self, r):
        res = 0
        while r > 0:
            res += self.b[r]
            r -= r & (-r)
        return res


if __name__ == "__main__":
    solve()

import sys
from itertools import accumulate

inf = 1 << 60
ans = 0


def solve():
    n, k = list(map(int, sys.stdin.readline().split()))
    a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
    s = [0] + list(accumulate(a))
    MergeSort(s)
    print(ans)


def MergeSort(a):
    if len(a) == 1:
        return a
    apre = MergeSort(a[: len(a) // 2])
    asuf = MergeSort(a[len(a) // 2 :])
    res = merge(apre, asuf)
    return res


def merge(a, b):
    global ans
    na = len(a)
    nb = len(b)
    a.append(-inf)
    b.append(-inf)
    la = 0
    lb = 0
    res = []
    for i in range(na + nb):
        if a[la] <= b[lb]:
            ans += na - la
            res.append(b[lb])
            lb += 1
        else:
            res.append(a[la])
            la += 1
    return res


if __name__ == "__main__":
    solve()

+ +inf = 1 << 60 +ans = 0 -    # 座標圧縮 -    s = [(si, i) for (i, si) in enumerate(s)] -    s.sort() -    z = [None] * (n + 1) -    num = -1 -    p = -float("inf") -    for i in range(n + 1): -        if s[i][0] > p: -            num += 1 -        z[s[i][1]] = num -        p = s[i][0] -    # FenwickTreeで転倒数を数える -    ft = FenwickTree(num + 1) -    ans = 0 -    for zi in z: -        ans += ft.psum(zi + 1) -        ft.add(zi, 1) +    MergeSort(s) -class FenwickTree: -    def __init__(self, n): -        self.n = n -        self.b = [0] * (n + 1) +def MergeSort(a): +    if len(a) == 1: +        return a +    apre = MergeSort(a[: len(a) // 2]) +    asuf = MergeSort(a[len(a) // 2 :]) +    res = merge(apre, asuf) +    return res -    def add(self, i, x): -        i += 1 -        while i <= self.n: -            self.b[i] += x -            i += i & (-i) -    def psum(self, r): -        res = 0 -        while r > 0: -            res += self.b[r] -            r -= r & (-r) -        return res +def merge(a, b): +    global ans +    na = len(a) +    nb = len(b) +    a.append(-inf) +    b.append(-inf) +    la = 0 +    lb = 0 +    res = [] +    for i in range(na + nb): +        if a[la] <= b[lb]: +            ans += na - la +            res.append(b[lb]) +            lb += 1 +        else: +            res.append(a[la]) +            la += 1 +    return res