import bisect

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


dp=[[0]*(2*N*A+1) for _ in [0]*(N+1)]
dp[0][N*A]=1
# dp[n][k]:n番目までの整数でkが作れる場合の数
    
for n in range(1,N+1):
    for k in range(-N*A,N*A+1):
        dp[n][k]+=dp[n-1][k-x[n-1]]+dp[n-1][k]

print(dp[N][N*A]-1)