import itertools
import bisect
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
ruiseki = [0]+itertools.accumulate(A)
ans = 0
for j in range(1,N+1):
    if ruiseki[i] >= K:
        ans += bisect.bisect(A,A[i]-K)
print(ans)