CodeEff/ECCO huggingface dataset:
# Original solution
def tak_and_cards(N: int, A: int, x: list) -> int:
    count = 0
    for b in range(1, 1 << N):
        n, s = 0, 0
        for i in range(N):
            if (b >> i) & 1 == 0:
                continue
            n += 1
            s += x[i]

        if s == n * A:
            count += 1
    return count


if __name__ == "__main__":
    N, A = list(map(int, input().split()))
    x = [int(s) for s in input().split()]
    ans = tak_and_cards(N, A, x)
    print(ans)


# Optimized solution
def tak_and_cards(N: int, A: int, X: list) -> int:
    #  部分点解法
    # :---------:
    # count = 0
    # for b in range(1, 1 << N):
    #     n, s = 0, 0
    #     for i in range(N):
    #         if (b >> i) & 1 == 0:
    #             continue
    #         n += 1
    #         s += X[i]

    #     if s == n * A:
    #         count += 1
    # return count
    max_X = max(X)
    dp = [[0] * (2 * max_X * N + 1) for _ in range(N + 1)]
    dp[0][max_X * N] = 1

    for k, x in enumerate(X):
        for t in range(2 * max_X * N + 1):
            y = x - A

            dp[k + 1][t] = dp[k][t]
            if 0 <= t - y and t - y <= 2 * max_X * N:
                dp[k + 1][t] += dp[k][t - y]

    return dp[N][max_X*N] - 1


if __name__ == "__main__":
    N, A = list(map(int, input().split()))
    x = [int(s) for s in input().split()]
    ans = tak_and_cards(N, A, x)
    print(ans)
# Original solution
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
 
lim = sum(x)
dp = [[0]*(lim + 1) for i in range(N + 1)]
 
dp[0][0] = 1
 
for i in range(N):
    for k in range(N, 0, -1):
        for v in range(lim, -1, -1):
            if v - x[i] < 0:
                break
            dp[k][v] += dp[k - 1][v - x[i]]
 
ans = 0

for k in range(1, N + 1):
    if k*A > lim:
        break
    ans += dp[k][k*A]

print(ans)

# Optimized solution
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]

# 3d DP
max_x = max(x)

dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
                             for i in range(N + 1)]

dp[0][0][0] = 1

for i in range(0, N):
    for k in range(0, N + 1):
        for y in range(max_x * N + 1):
            if dp[i][k][y]:
                dp[i + 1][k][y] += dp[i][k][y]
                dp[i + 1][k + 1][y + x[i]] += dp[i][k][y]
    
cnt = 0
for k in range(1, N + 1):
    for y in range(1, max_x * N + 1):
        if y // k == A and y % k == 0:
            cnt += dp[N][k][y]

print(cnt)
# Original solution
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]

# 3d DP
max_x = max(x)

dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
                             for i in range(N + 1)]

dp[0][0][0] = 1

for i in range(0, N):
    for k in range(0, N + 1):
        for y in range(max_x * N + 1):
            if dp[i][k][y]:
                dp[i + 1][k][y] += dp[i][k][y]
                dp[i + 1][k + 1][y + x[i]] += dp[i][k][y]
    
cnt = 0
for k in range(1, N + 1):
    for y in range(1, max_x * N + 1):
        if y // k == A and y % k == 0:
            cnt += dp[N][k][y]

print(cnt)

# Optimized solution
def solve():
    N, A = list(map(int, input().split()))
    x = [int(i) for i in input().split()]
 
    # 3d DP
    max_x = max(x)
 
    dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
                                 for i in range(N + 1)]
 
    dp[0][0][0] = 1
 
    for i in range(0, N):
        for k in range(0, N + 1):
            for y in range(max_x * N + 1):
                if dp[i][k][y]:
                    dp[i + 1][k][y] += dp[i][k][y]
                    dp[i + 1][k + 1][y + x[i]] += dp[i][k][y]
                    
    cnt = 0
    for k in range(1, N + 1):
        for y in range(1, max_x * N + 1):
            if y // k == A and y % k == 0:
                cnt += dp[N][k][y]
 
    print(cnt)
 
if __name__ == '__main__':
    solve()
# Original solution
def solve():
    N, A = list(map(int, input().split()))
    x = [int(i) for i in input().split()]
 
    # 3d DP
    max_x = max(x)
 
    dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
                                 for i in range(N + 1)]
 
    dp[0][0][0] = 1
 
    for i in range(0, N):
        for k in range(0, N + 1):
            for y in range(max_x * N + 1):
                if dp[i][k][y]:
                    dp[i + 1][k][y] += dp[i][k][y]
                    dp[i + 1][k + 1][y + x[i]] += dp[i][k][y]
                    
    cnt = 0
    for k in range(1, N + 1):
        for y in range(1, max_x * N + 1):
            if y // k == A and y % k == 0:
                cnt += dp[N][k][y]
 
    print(cnt)
 
if __name__ == '__main__':
    solve()

# Optimized solution
def solve():
    N, A = list(map(int, input().split()))
    x = [int(i) for i in input().split()]
     
    lim = sum(x)
    dp = [[0]*(lim + 1) for i in range(N + 1)]
     
    dp[0][0] = 1
     
    for i in range(N):
        for k in range(i + 1, 0, -1):
            for v in range(lim, x[i] - 1, -1):
                dp[k][v] += dp[k - 1][v - x[i]]
     
    ans = 0
     
    for k in range(1, N + 1):
        if k*A > lim:
            break
        ans += dp[k][k*A]
     
    print(ans)
 
if __name__ == '__main__':
    solve()
# Original solution
n, a = list(map(int, input().split()))
cnt = [0]
x = list(map(int, input().split()))
check = [0 for i in range(n)]


def ave(idx, k):
    if idx == n:
        s = 0
        for i in range(n):
            if check[i]:
                s += x[i]

        if s == k * a and k != 0:
            cnt[0] += 1

        return

    ave(idx+1, k)
    check[idx] = 1
    ave(idx+1, k+1)
    check[idx] = 0


def main():
    ave(0, 0)
    print((cnt[0]))


if __name__ == '__main__':
    main()


# Optimized solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))


def ave_comb(v_max, ave):
    dp = [[[0 for c in range(n*v_max+1)] for b in range(n+1)] for a in range(n+1)]

    for i in range(n+1):
        dp[i][0][0] = 1

    for i in range(1, n+1):
        for j in range(1, i+1):
            for k in range(1, n*v_max+1):
                if k - x[i-1] >= 0:
                    dp[i][j][k] = dp[i-1][j-1][k-x[i-1]] + dp[i-1][j][k]
                else:
                    dp[i][j][k] = dp[i-1][j][k]

    ans = 0
    for t in range(1, n+1):
        ans += dp[n][t][ave*t]

    return ans


def main():
    x_max = max(max(x), a)

    print((ave_comb(x_max, a)))


if __name__ == '__main__':
    main()
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))


def ave_comb(v_max, ave):
    dp = [[[0 for c in range(n*v_max+1)] for b in range(n+1)] for a in range(n+1)]

    for i in range(n+1):
        dp[i][0][0] = 1

    for i in range(1, n+1):
        for j in range(1, i+1):
            for k in range(1, n*v_max+1):
                if k - x[i-1] >= 0:
                    dp[i][j][k] = dp[i-1][j-1][k-x[i-1]] + dp[i-1][j][k]
                else:
                    dp[i][j][k] = dp[i-1][j][k]

    ans = 0
    for t in range(1, n+1):
        ans += dp[n][t][ave*t]

    return ans


def main():
    x_max = max(max(x), a)

    print((ave_comb(x_max, a)))


if __name__ == '__main__':
    main()


# Optimized solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))

x_max = max(x)
y = [i-a for i in x]


def ave_comb():
    dp = [[0 for d in range(2*n*x_max+1)] for c in range(n+1)]
    for i in range(n+1):
        dp[i][n*x_max] = 1

    for i in range(1, n+1):
        for j in range(1, 2*n*x_max+1):
            if 0 <= j - y[i-1] <= 2 * n * x_max:
                dp[i][j] = dp[i-1][j-y[i-1]] + dp[i-1][j]
            else:
                dp[i][j] = dp[i-1][j]

    return dp[n][n*x_max] - 1


def main():
    print((ave_comb()))


if __name__ == '__main__':
    main()
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[[0 for k in range(x_sum + 1)] for j in range(n + 1)] for i in range(2)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        idx = i % 2
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[idx][j][k] = dp[1 - idx][j][k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[idx][j][k] = dp[1 - idx][j][k] + dp[1 - idx][j - 1][k - x[i - 1]]

    for j in range(1, min(x_sum // a + 1, n + 1)):
        ans += dp[idx][j][j * a]
print(ans)


# Optimized solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)
# Original solution
n,a = list(map(int,input().split()))
l = list(map(int,input().split()))

dp = [[[0]*(2501) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0] = 1

# i 個目までのj個選んで　和のmod aが k

for i in range(n):    
    for j in range(i+1):
        for k in range(2501):

            dp[i+1][j][k] += dp[i][j][k]
            if k+l[i] < 2501:
                dp[i+1][j+1][k+l[i]] += dp[i][j][k]


ans = 0
for j in range(1,n+1):
    ans += dp[-1][j][j*a]
print(ans)


# Optimized solution
n,a = list(map(int,input().split()))
l = list(map(int,input().split()))

dp = [[[0]*(2501) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0] = 1



for i in range(n):    
    for j in range(i+1):
        for k in range(2501):

            dp[i+1][j][k] += dp[i][j][k]
            if k+l[i] < 2501:
                dp[i+1][j+1][k+l[i]] += dp[i][j][k]


ans = 0
for j in range(1,n+1):
    ans += dp[-1][j][j*a]
print(ans)
# Original solution
n,a = [int(i) for i in input().split()]

X = [int(i) for i in input().split()]
X = [0]+X
m = max(X+[a])
dp = [[[0]*50*(n+1) for i in range(n+1)] for j in range(n+1)]
#print(dp)


for i in range(n+1):
    for j in range(n+1):
        for k in range(m*(n+1)):
            if i == j == k == 0:
                dp[i][j][k] = 1
            elif i >= 1 and k < X[i]:
                dp[i][j][k] = dp[i-1][j][k]
            elif i >= 1 and j >= 1 and k >= X[i]:
                dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k-X[i]]

         

ans = 0
for i in range(1,n+1):
    ans += dp[n][i][i*a]
    
print(ans)

# Optimized solution
n,a = [int(i) for i in input().split()]

X = [int(i)-a for i in input().split()]
dp = [[0]*(100*n+1) for i in range(n+1)]
#print(dp)
dp[0][50*n]=1

for i in range(n):
    for j in range(50,100*n+1-50):
            dp[i+1][j] = dp[i][j]+dp[i][j-X[i]]
        
ans = dp[n][n*50]-1
    
print(ans)
# Original solution
N,A=list(map(int,input().split()))
X=[int(a) for a in input().split()]
X.append(0)
X.sort()
ma=sum(X)

#[x]までのy個を使ってzを作る場合の数を数え上げるdp
#dp[x][y][z]=dp[x-1][y][z]+dp[x-1][y-1][z-X[x]](zが残っている場合）
#dp[x][y][z]=dp[x-1][y][z](zが残っていない場合)
dp=[[[0] * (ma+1) for i in range(N+1)] for j in range(N+1)]
for i in range(N+1):
  dp[i][0][0]=1
for i in range(1,N+1):
  cnt=X[i]
  for j in range(1,N+1):
    for k in range(ma+1):
      if k < cnt:
        dp[i][j][k]=dp[i-1][j][k]
      else:
        dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-cnt]

#ansはN枚中j枚使用かつj枚*平均Aを作れる個数。
ans=0
for x in range(1,N+1):
  if x*A<=ma:
    ans+=dp[N][x][x*A]
print(ans)


# Optimized solution
def solve(N,A,X):  
  X.append(0)
  X.sort()
  ma=sum(X)

#[x]までのy個を使ってzを作る場合の数を数え上げるdp
#dp[x][y][z]=dp[x-1][y][z]+dp[x-1][y-1][z-X[x]](zが残っている場合）
#dp[x][y][z]=dp[x-1][y][z](zが残っていない場合)
  dp=[[[0] * (ma+1) for i in range(N+1)] for j in range(N+1)]
  
#[x]までの0個を使って0を作る方法は1つ（dp初期化）
  for i in range(N+1):
    dp[i][0][0]=1
  for i in range(1,N+1):
    cnt=X[i]
    for j in range(1,N+1):
      for k in range(ma+1):
        if k < cnt:
          dp[i][j][k]=dp[i-1][j][k]
        else:
          dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-cnt]

#ansはN枚中j枚使用かつj枚*平均Aを作れる個数。
  ans=0
  for x in range(1,N+1):
    if x*A<=ma:
      ans+=dp[N][x][x*A]
  return ans

N,A=list(map(int,input().split()))
X=[int(a) for a in input().split()]
ans=solve(N,A,X)
print(ans)
# Original solution
n, a = list(map(int, input().split()))
X = tuple(map(int, input().split()))
X = sorted(X)

from collections import deque
ans = 0
for i in range(n):
    st = deque([[i, 1, X[i]]])
    while st:
        idx, count, s = st.pop()
        if count*a == s:
            ans += 1
        elif count*a < s:
            continue
        
        for ni in range(idx+1, n):
            st.append([ni, count+1, s+X[ni]])
print(ans)
        

# Optimized solution
n, a = list(map(int, input().split()))
X = tuple(map(int, input().split()))
dp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    # i枚目までで
    for j in range(n):
        # j枚のカードを選んで
        for s in range(n*a+1):
            # 合計がsになるパターン
            if dp[i][j][s] == 0:
                continue
            # i枚目のカードが選ばれない場合
            dp[i+1][j][s] += dp[i][j][s]
            # i枚目のカードが選ばれる場合
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)
# Original solution
N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]

import functools
@functools.lru_cache(maxsize=None)
def f(acc, left):
    if not left: return 0
    ret = 0
    y = acc + left[0]
    ret += 1 if y == 0 else 0
    ret += f(y, left[1:])
    ret += f(acc, left[1:])
    return ret
print((f(0, tuple(X))))

# Optimized solution
N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]

from collections import Counter

total = Counter([0])
for x in X:
    mix = Counter()
    for i, cnt in list(total.items()):
        mix[i + x] += cnt
    total += mix

print((total[0] - 1))
# Original solution
from itertools import product

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

max_x = max(max(x), A)
dp = [[[0 for _ in range((N + 1) * max_x)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1

for j, k, s in product(list(range(1, N + 1)), list(range(N + 1)), list(range((N + 1) * max_x))):
    if s < x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s]
    elif k >= 1 and s >= x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]

ans = 0
for k in range(1, N + 1):
    ans += dp[N][k][k * A]
print(ans)

# Optimized solution
from itertools import product

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

X = max(max(x), A)
dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]
dp[0][N * X] = 1

for j, t in product(list(range(1, N + 1)), list(range(2 * N * X + 1))):
    y = x[j - 1] - A
    if t - y < 0 or t - y > 2 * N * X:
        dp[j][t] = dp[j - 1][t]
    elif 0 <= t - y <= 2 * N * X:
        dp[j][t] = dp[j - 1][t] + dp[j - 1][t - y]
print((dp[N][N * X] - 1))
# Original solution
from collections import defaultdict

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

for i in range(N):
    x[i] -= A
X = max(max(x), A)

dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(-N * X, N * X + 1):
        if - N * X <= j - x[i] <= N * X:
            dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]]
        else:
            dp[i + 1][j] = dp[i][j]
print((dp[N][0] - 1))


# Optimized solution
from collections import defaultdict

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

for i in range(N):
    x[i] -= A
X = max(max(x), A)

dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(-N * X, N * X + 1):
        dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]]
print((dp[N][0] - 1))
# Original solution
N,A = list(map(int,input().split()))
x = list(map(int,input().split()))

temp = x + [A]

X = max(temp)

m = N * X

dp = [[[0]*(m+1) for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

res = 0

for j in range(N+1):
    for k in range(N+1):
        for s in range(m+1):
            if (j >= 1) & (s < x[j-1]):
                dp[j][k][s] = dp[j-1][k][s]
            elif (j >= 1) & (k >= 1) & (s >= x[j-1]):
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]

        if (k >= 1) & (j == N):
            res += dp[N][k][k*A]

print(res)


# Optimized solution
N,A = list(map(int,input().split()))
x = list(map(int,input().split()))

temp = x + [A]

X = max(temp)

m = N * X

dp = [[[0 for s in range(m+1)] for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

res = 0

for j in range(N):
    for k in range(N):
        for s in range(m):
            if dp[j][k][s]:
                dp[j+1][k][s] += dp[j][k][s]
                dp[j+1][k+1][s+x[j]] += dp[j][k][s]

for k in range(1,N+1):
    res += dp[N][k][k*A]

print(res)
# Original solution
import sys
from sys import stdin
input = stdin.readline

def solve(N, A, x):
    x.append(0)
    x.sort()
    W=sum(x)
    dp=[[[0]*(W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0]=1
    for j in range(1,N+1):
        xj=x[j]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s<xj:
                    dp[j][k][s]=dp[j-1][k][s]
                else:
                    dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-xj]

    ans=0
    for k in range(1,N+1):
        if k*A<=W:
            ans+=dp[N][k][k*A]
        else:
            break
    return ans


def main(args):
    N,A=list(map(int, input().split()))
    x=[int(x) for x in input().split()]
    print((solve(N, A, x)))

if __name__ == '__main__':
    main(sys.argv[1:])


# Optimized solution
import sys
from sys import stdin
input = stdin.readline

def solve(N, A, x):
    x.append(0)
    x.sort()
    W=sum(x)
    dp=[[[0]*(W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0]=1
    for j in range(1,N+1):
        xj=x[j]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s<xj:
                    dp[j][k][s]=dp[j-1][k][s]
                else:
                    dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-xj]

    ans=0
    for k in range(1,N+1):
        if k*A<=W:
            ans+=dp[N][k][k*A]
        else:
            break
    return ans


def main(args):
    N,A=list(map(int, input().split()))
    x=[int(x) for x in input().split()]
    ans=solve(N,A,x)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])
# Original solution
import sys
from sys import stdin
input = stdin.readline

def solve(N, A, x):
    x.append(0)
    x.sort()
    W=sum(x)
    dp=[[[0]*(W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0]=1
    for j in range(1,N+1):
        xj=x[j]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s<xj:
                    dp[j][k][s]=dp[j-1][k][s]
                else:
                    dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-xj]

    ans=0
    for k in range(1,N+1):
        if k*A<=W:
            ans+=dp[N][k][k*A]
        else:
            break
    return ans


def main(args):
    N,A=list(map(int, input().split()))
    x=[int(x) for x in input().split()]
    ans=solve(N,A,x)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])


# Optimized solution
import sys
from sys import stdin
input = stdin.readline

def solve(N, A, x):
    W=sum(x)
    dp=[[[0]*(W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0]=1
    for j in range(1,N+1):
        xj=x[j-1]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s<xj:
                    dp[j][k][s]=dp[j-1][k][s]
                else:
                    dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-xj]

    ans=0
    for k in range(1,N+1):
        if k*A<=W:
            ans+=dp[N][k][k*A]
        else:
            break
    return ans


def main(args):
    N,A=list(map(int, input().split()))
    x=[int(x) for x in input().split()]
    ans=solve(N,A,x)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])
# Original solution
from functools import lru_cache
n, a = list(map(int, input().split(' ')))
x = list(map(int, input().split(' ')))
t = 0
@lru_cache(maxsize=1024)
def dfs(i,ave):
    if i ==n:
        if ave == 0:
            return 1
        else:
            return 0

    return dfs(i+1,ave)+dfs(i+1,ave+x[i]-a)



print((dfs(0,0)-1))


# Optimized solution
n,a = list(map(int, input().split(' ')))
x = list(map(int, input().split(' ')))
y = [i - a for i in x]
X = max(a,max(x))

dp = []
for i in range(n+1):
    dp.append([0]*(2*n*X+1))
for j in range(n,-1,-1):
    for t in range(2*n*X+1):
        if j == n and t ==n*X:
            dp[j][t] = 1
        elif j == n:
            dp[j][t] = 0
        elif 0 <= t-y[j] <= 2*n*X:
            dp[j][t] = dp[j+1][t] + dp[j+1][t-y[j]]
        else:
            dp[j][t] = dp[j+1][t]
def main():
    print((dp[0][n*X]-1))
if __name__ == '__main__':
    main()
# Original solution
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a = list(map(int, input().split()))
    X = list(map(int, input().split()))
    MAX = 50 * 50 + 1

    dp = [[[0] * MAX for _ in range(n + 1)] for _ in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        x = X[i - 1]
        for j in range(n):
            for k in range(MAX):
                dp[i][j][k] += dp[i - 1][j][k]
                if k + x < MAX:
                    dp[i][j + 1][k + x] += dp[i - 1][j][k]
    res = 0
    for j in range(1, n + 1):
        res += dp[-1][j][a * j]
    print(res)


if __name__ == '__main__':
    resolve()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 998244353


def resolve():
    n, a = list(map(int, input().split()))
    X = list(map(int, input().split()))
    MAX = sum(X)
    dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        x = X[i - 1]
        for j in range(n + 1):
            for k in range(MAX + 1):
                dp[i][j][k] += dp[i - 1][j][k]
                if k + x < MAX + 1 and j + 1 <= n:
                    dp[i][j + 1][k + x] += dp[i - 1][j][k]
    res = 0
    for j in range(1, n + 1):
        total = a * j
        if total <= MAX:
            res += dp[n][j][total]
    print(res)


if __name__ == '__main__':
    resolve()
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(max(x), a)
#dp = [[[0]*(n*X+1) for _ in range(X+1)] for i in range(n+1)]
dp = [[[0]*(n*X+1) for _ in range(n+1)] for i in range(n+1)]

for j in range(n+1):
    for k in range(n+1):
        for s in range(n*X+1):
            if j == 0 and k == 0 and s == 0:
                dp[j][k][s] = 1
            elif j >= 1 and s < x[j-1]:
                dp[j][k][s] = dp[j-1][k][s]
            elif j >= 1 and k >= 1 and s >= x[j-1]:
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]
            else:
                dp[j][k][s] = 0
ans = 0
for k in range(1,n+1):
    ans += dp[n][k][k*a]
print(ans)

# Optimized solution
# 配列を大きめにとって配った方がすっきりかけるのかも

n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(max(x), a)
dp = [[[0]*(n*X+1) for _ in range(n+1)] for i in range(n+1)]

#if j == 0 and k == 0 and s == 0:
dp[0][0][0] = 1
for j in range(n):
    for k in range(n):
        for s in range(n*X):

            if dp[j][k][s]:
                dp[j+1][k][s] += dp[j][k][s]
                dp[j+1][k+1][s+x[j]] += dp[j][k][s]
ans = 0
for k in range(1,n+1):
    ans += dp[n][k][k*a]

print(ans)