n,a=[int(_) for _ in input().split()]
y=[int(_)-a for _ in input().split()]
dp=[[0 for sum in range(2*n*a+51)] for right in range(n)]
dp[0][0+n*a]=1;dp[0][y[0]+n*a]=1
for right in range(n-1):
    for sum in range(-n*a, n*a+1):
        dp[right+1][sum+n*a]+=dp[right][sum+n*a]
        dp[right+1][sum+y[right+1]+n*a]+=dp[right][sum+n*a]
print(dp[-1][n*a]-1)