N, A = map(int, input().split())
xs = list(map(int, input().split()))

sumX = sum(xs)

# dp[i][j]: i枚で合計jとなる選び方の個数
dp = [[0] * (sumX + 1) for _ in range(N + 1)]
dp[0][0] = 1
for k, x in enumerate(xs):
    for i in reversed(range(k + 1)):
        for j in range(sumX + 1):
            if dp[i][j] == 0: continue
            dp[i + 1][j + x] += dp[i][j]

# 平均A = i枚で合計(A*i)
ans = 0
for i in range(1, min(N, sumX // A) + 1):
    ans += dp[i][A * i]
print(ans)
