from collections import defaultdict
from itertools import accumulate

N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
def subarraySum(nums, k):
    dic = defaultdict(int)
    dic[0] = 1
    cnt = [0] * len(nums)
    ans, cum_sum = 0, 0
    idx_dic = defaultdict(list)
    for i, num in enumerate(nums):
        cum_sum += num
        if cum_sum - k in dic:
            ans += dic[cum_sum - k]
        dic[cum_sum] += 1
        cnt[i] = ans
    return ans, cnt

ans = 0
for i in range(N):
    _, cnt = subarraySum(A[i:], S)
    ans += sum(cnt)
print(ans)