N,A = map(int,input().split())
x = [0] + [int(i)-A for i in input().split()]

from collections import defaultdict

dp = defaultdict(int)

for i in range(N+1):
    for j in range(min(-2500,x[i]-2500),max(2501,2501+x[i])):
        if i == 0 and j == 0:
            dp[(i,j)] = 1
        else:
            dp[(i,j)] = dp[(i-1,j)] + dp[(i-1,j-x[i])]
print(dp[(N,0)]-1)