N, K = list(map(int, input().split()))

A = [int(eval(input())) for _ in range(N)]



B = [0] * (N + 1)

B[1] = A[0] - K

for i in range(1, N):

    A[i] += A[i - 1]

    B[i + 1] = A[i] - K * (i + 1)



tmp = sorted(B)



dic = dict()

for index, x in enumerate(tmp):

    dic[x] = index





N = len(B)

bit = [0] * (N + 1)

def total(i):

    s = 0

    while i > 0:

        s += bit[i]

        i -= i & -i

    return s



def add(i, x):

    while i <= N:

        bit[i] += x

        i += i & -i

    return



ans = 0

for b in B:

    # print (b)

    n = dic[b]

    ans += total(n + 1)

    # print (b, ans)

    # print ()

    add(n + 1, 1)



print (ans)

# print (B)

# print (dic)

# print (bit)
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7



N, K = list(map(int, input().split()))

A = [0] + [int(eval(input())) - K for _ in range(N)]



# print (A)

for i in range(N):

    A[i + 1] += A[i]



B = sorted(A)

dic = dict()

for i, b in enumerate(B):

    dic[b] = i + 1



N += 1

bit = [0] * (N + 1)

def total(i):

    s = 0

    while i > 0:

        s += bit[i]

        i -= i & -i

    return s



def add(i, x):

    while i <= N:

        bit[i] += x

        i += i & -i

    return



ans = 0

for a in A:

    b = dic[a]

    ans += total(b)

    # print ('tmp')

    add(b, 1)



print (ans)

# print (A)

# print (dic)
N, K = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [0] * (N + 1)
B[1] = A[0] - K
for i in range(1, N):
    A[i] += A[i - 1]
    B[i + 1] = A[i] - K * (i + 1)
tmp = sorted(B)
dic = dict()
for index, x in enumerate(tmp):
    dic[x] = index
N = len(B)
bit = [0] * (N + 1)


def total(i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= i & -i
    return s


def add(i, x):
    while i <= N:
        bit[i] += x
        i += i & -i
    return


ans = 0
for b in B:
    # print (b)
    n = dic[b]
    ans += total(n + 1)
    # print (b, ans)
    # print ()
    add(n + 1, 1)
print(ans)
# print (B)
# print (dic)
# print (bit)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, K = list(map(int, input().split()))
A = [0] + [int(eval(input())) - K for _ in range(N)]
# print (A)
for i in range(N):
    A[i + 1] += A[i]
B = sorted(A)
dic = dict()
for i, b in enumerate(B):
    dic[b] = i + 1
N += 1
bit = [0] * (N + 1)


def total(i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= i & -i
    return s


def add(i, x):
    while i <= N:
        bit[i] += x
        i += i & -i
    return


ans = 0
for a in A:
    b = dic[a]
    ans += total(b)
    # print ('tmp')
    add(b, 1)
print(ans)
# print (A)
# print (dic)

+import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**9) +MOD = 10**9 + 7 -A = [int(eval(input())) for _ in range(N)] -B = [0] * (N + 1) -B[1] = A[0] - K -for i in range(1, N): -    A[i] += A[i - 1] -    B[i + 1] = A[i] - K * (i + 1) -tmp = sorted(B) +A = [0] + [int(eval(input())) - K for _ in range(N)] +# print (A) +for i in range(N): +    A[i + 1] += A[i] +B = sorted(A) -for index, x in enumerate(tmp): -    dic[x] = index -N = len(B) +for i, b in enumerate(B): +    dic[b] = i + 1 +N += 1 -for b in B: -    # print (b) -    n = dic[b] -    ans += total(n + 1) -    # print (b, ans) -    # print () -    add(n + 1, 1) +for a in A: +    b = dic[a] +    ans += total(b) +    # print ('tmp') +    add(b, 1) -# print (B) +# print (A) -# print (bit)