n, a = map(int, input().split())
x = [int(i) for i in input().split()]
x_dict = {i:xx for i, xx in enumerate(x)}
count = 0
for i in range(1, 2 ** n):
    temp = bin(i)[2:]
    temp = ("0" * (n - len(temp))) + temp
    mean_x = 0
    temp_list = [j for j, t in enumerate(temp) if t == "1"]
    for j in temp_list:
        mean_x = x_dict[j]
    if mean_x == a * (temp.count("1")):
        count += 1
print(count)