n, s = map(int, input().split())

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

B = []
t = 0
import itertools
for i in range(0, n):
    for j in range(i, n):
        # if sum(A[i:j+1]) == s:
            # B.append([i, j])
        for l in range(1, j - i + 1+1):
            for k in itertools.combinations(A[i:j+1], l):
                if sum(k) == s:
                    t += 1

print(t)
