from collections import Counter
N, S = map(int, input().split())
As = list(map(int, input().split()))

ans = 0
for i in range(N):
    cts = Counter([0])
    for j in range(i, N):
        a = As[j]
        ncts = Counter()
        for k, v in cts.items():
            ncts[k] += v
            ncts[k+a] += v
        cts = ncts
        ans += cts[S]
print(ans)