N, S = map(int, input().split())
A = list(map(int, input().split()))
P = 998244353
f = [[[0 for _ in range(S+1)] for _ in range(N)] for _ in range(N)]

for LR in range(N):
    f[LR][LR][0] = 1
    f[LR][LR][A[LR]] = 1
for L in range(N):
    for R in range(L+1, N):
        a = A[R]
        for s in range(a):
            f[L][R][s] = f[L][R - 1][s]
        for s in range(a, S+1):
            f[L][R][s] = f[L][R-1][s] + f[L][R-1][s-a]

ans = 0
for L in range(N):
    for R in range(L, N):
        ans += f[L][R][S]
print(ans)
