n,a = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
count = 0
for i in x:
    if i == 8:
        count+=1
res = 0
for i in range(1,2**n):
    bit = bin(i)[2:]
    k = bit.count("1")
    sum = 0
    for i in range(1,len(bit)+1):
        if bit[-i]=="1":
            sum += x[-i]
    if sum==a*k:
        res += 1

print(res)
    