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

A = list(map(int, input().split()))

total_comb = 0

for left_start in range(N):
    dp = [0] * (S+1)
    dp[0] = 1
    for j in range(left_start, N):
        v = A[j]
        for i in range(S, -1, -1):
            if i - v >= 0:
                dp[i] += dp[i-v]
        total_comb += dp[S]
    # print(dp)

print(total_comb)
