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

ans = 0
if N == 1:
    if N == A:
        print(1)
        quit()
    else:
        print(0)
        quit()
for i in range(1, 2**N+1):
    b = bin(i)[2:]
    b = '0' * (N-len(b)) + b
    curSum = 0
    curAdd = 0
    for j in range(N):
        curSum += int(b[j]) * X[j]
        if b[j] == '1':
            curAdd += 1
    if curSum == A * curAdd:
        ans += 1

print(ans)