CodeEff/ECCO huggingface dataset:
# Original solution
import itertools
N, A = list(map(int, input().split()))
x = sorted([int(i)-A for i in input().split()])
ans = x.count(0)

if N >= 2:
    for i in range(2, N+1):
        check = list(itertools.combinations(x,i))
        for i in check:
            if sum(i) == 0:
                ans += 1

print(ans)

# Optimized solution
N, A = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
 
dp = [[0] * (sum(x)+1) for j in range(N+1)]
 
dp[0][0] = 1
for i in range(1, N+1):
    for j in list(range(1, N+1))[::-1]:
        for k in list(range(x[i-1], sum(x[:i])+1))[::-1]:
            dp[j][k] += dp[j-1][k - x[i-1]]
 
print((sum([dp[i][i*A] for i in range(1, N+1) if i*A <= sum(x)])))
# Original solution
N, A = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
 
dp = [[0] * (sum(x)+1) for j in range(N+1)]
 
dp[0][0] = 1
for i in range(1, N+1):
    for j in list(range(1, N+1))[::-1]:
        for k in list(range(x[i-1], sum(x[:i])+1))[::-1]:
            dp[j][k] += dp[j-1][k - x[i-1]]
 
print((sum([dp[i][i*A] for i in range(1, N+1) if i*A <= sum(x)])))

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

dp = [[0 for j in range(100 * N + 1)] for i in range(N + 1)]
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]]
        
print((dp[N][50 * N] - 1))
# Original solution
N, A = list(map(int,input().split()))
X = list(map(int,input().split()))
dp = [[[0 for i in range(N*50+1)] for j in range(N+1)] for k in range(N+1)]
for i in range(N+1):
    dp[i][0][0] = 1
for i in range(1,N+1):
    x = X[i-1]
    for j in range(1,N+1):
        for k in range(N*50+1):
            if k < x:
                dp[i][j][k] = dp[i-1][j][k]
                
            elif j > i:
                dp[i][j][k] = 0
                
            else: 
                dp[i][j][k] += dp[i-1][j][k] + dp[i-1][j-1][k-x]
ans = 0
for i in range(1,N+1):
    ans += dp[N][i][A*i]
print(ans)


# Optimized solution
N,A = list(map(int,input().split()))
X = list(map(int,input().split()))
for i in range(N):
    X[i] -= A
dp = [[0 for i in range(5001)] for i in range(N+1)]
dp[0][2500] = 1
u = 2500
d = 2500
for i in range(1,N+1):
    x = X[i-1]
    if x <= 0:
        d += x
    else:
        u += x
    for j in range(d,u+1):
        dp[i][j] += dp[i-1][j-x] + dp[i-1][j]
print((dp[N][2500]-1))
# Original solution
N, A = input().split(" ")
N, A = int(N), int(A)
x = input().split(" ")
x = [int(i) for i in x]

import itertools

cnt = 0
for n in range(1, N+1):
    for i in itertools.combinations(x, n):
        if sum(i) / n == A:
            cnt += 1
print(cnt)

# Optimized solution
N, A = input().split(" ")
N, A = int(N), int(A)
x = input().split(" ")
x = [int(i) for i in x]
y = [0]+[int(i)-A for i in x]
X = max(x+[A])

dp = [[0 for t in range(2*N*X+1)] for j in range(N+1)]

for j in range(N+1):
    for t in range(2*N*X+1):
        if j == 0 and t == N*X:  # 0枚の時は0しか達成できない
            dp[j][t] = 1
        elif j >= 1 and (t - y[j-1] < 0 or t-y[j] > 2*N*X):  # xの値が平均Aを超えてしまう場合は、前回の結果から場合の総数に変化なし
            dp[j][t] = dp[j-1][t]
        elif j >= 1 and 0 <= t-y[j-1] <= 2*N*X:  # 前回の場合の総数に、今回の数を足して0になる場合の総数を足す
            dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j]]
        else:
            dp[j][t] = 0
print((dp[N][N*X] - 1))
# Original solution
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
sum_X = sum(X)
dp = [[[0]*(sum_X+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
  for j in range(N):
    for k in range(sum_X):
      if dp[i][j][k] == 0: continue
      # not used
      dp[i+1][j][k] += dp[i][j][k]
      # used
      dp[i+1][j+1][k+X[i]] += dp[i][j][k]
ans = 0
for k in range(1, N+1):
  if k*A <= sum_X:
    ans += dp[N][k][k*A]
print(ans)  

# Optimized solution
N, A = list(map(int, input().split()))
# 予め-Kした状態で用意しておく
X = [A-int(x) for x in input().split()]
MAX = N*A*2
# dp[i][k] := i枚目までのカードで、合計をkにする通り数
dp = [[0]*(MAX+1) for _ in range(N+1)]
# 負の数を考慮して、N*K位置を0とする
dp[0][N*A] = 1
for i in range(N):
  x = X[i]
  for k in range(MAX+1):
    dp[i+1][k] += dp[i][k]
    if 0 <= k+x <= MAX:
      dp[i+1][k+x] += dp[i][k]
      
# N回終わって合計が0になっている通り数 - 1枚も取らないケース      
print((dp[N][N*A]-1))
# Original solution
from  collections import Counter

def main():
    num, avg = list(map(int, input().split()))
    data = list(map(int, input().split()))

    dp = [[[0 for i in range(6000)] for j in range(num + 1)] for k in range(num + 1)]
    dp[0][0][0] = 1

    for i in range(1, num + 1):
        now_card = data[i - 1]
        for j in range(num + 1):
            for k in range(6000):
                # print(i, j, k)
                dp[i][j][k] += dp[i - 1][j][k]
                if k - now_card >= 0 and j - 1 >= 0:
                    dp[i][j][k] += dp[i - 1][j - 1][k - now_card]
        # print(dp[i][j])

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





if __name__ == '__main__':
    main()


# Optimized solution
from  collections import Counter

def main():
    num, avg = list(map(int, input().split()))
    data = list(map(int, input().split()))
    
    max_num = max(num, avg, max(data))
    dp = [[[0 for i in range(max_num ** 2 + 1)] for j in range(num + 1)] for k in range(num + 1)]
    dp[0][0][0] = 1

    for i in range(1, num + 1):
        now_card = data[i - 1]
        for j in range(num + 1):
            for k in range(max_num ** 2 + 1):
                # print(i, j, k)
                dp[i][j][k] += dp[i - 1][j][k]
                if k - now_card >= 0 and j - 1 >= 0:
                    dp[i][j][k] += dp[i - 1][j - 1][k - now_card]
        # print(dp[i][j])

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





if __name__ == '__main__':
    main()
# Original solution
# -*- coding: utf-8 -*-

""" 3次元DP """

N,A = list(map(int, input().split()))
xN = list(map(int, input().split()))
X = max(max(xN), A)

# i(=xNリストからどこまでを選べる範囲とするか)からj(=0～N)枚選んで、選んだ値の合計をkにするような選び方の総数
dp = [[[0] * (N*X+1) for j in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 1

ans = 0
for i in range(1,N+1):
    for j in range(N+1):
        for k in range(N*X+1):
            # 求めたい合計(k)が、この周回で増えた選択肢(xN[i-1])より小さい場合、
            # 選び方の総数は増える見込みがないので前回の値をそのまま使用
            if k < xN[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            # 合計kが大きければ、増やせるかもしれないので、選んだ数と合計を減らしたところを見に行く
            # 選べる数j=0は論外だし、添え字[j-1]に良くないので条件で除外する
            elif k >= xN[i-1] and j > 0:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-xN[i-1]]
            # 選んだ数と合計から判断して、平均が条件に合うものなら答えに足す
            if i == N and j > 0 and k == j*A:
                ans += dp[i][j][k]

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

# Optimized solution
# -*- coding: utf-8 -*-

""" 2次元DP """

N,A = list(map(int, input().split()))
xN = list(map(int, input().split()))
X = max(max(xN), A)
# 全てのxから-Aすることで、合計=0,平均=0を求める形にする
yN = [int(i)-A for i in xN]

# 二つ目の添え字はマイナスを取りうるので工夫する
dp = [[0] * (2*N*X+1) for j in range(N+1)]
# 基準点を0じゃなくて真ん中(N*X)にする
dp[0][N*X] = 1

ans = 0
for i in range(1,N+1):
    for t in range(2*N*X+1):
        # 範囲外ならそのまま
        if t - yN[i-1] < 0 or t - yN[i-1] > 2*N*X:
            dp[i][t] = dp[i-1][t]
        # 範囲内なら前の値を足す
        elif 0 <= t - yN[i-1] <= 2*N*X:
            dp[i][t] = dp[i-1][t] + dp[i-1][t - yN[i-1]]
# 1枚も選ばないパターンを引く
print((dp[N][N*X]-1))
# Original solution
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
A = LIST()

MAX = N * K
# dp[i][j][k] := i枚目までからj枚取って、合計をkにする通り数
dp = list3d(N+1, N+1, MAX+1, 0)
dp[0][0][0] = 1
for i in range(N):
    a = A[i]
    for j in range(i+1):
        for k in range(MAX+1):
            dp[i+1][j][k] += dp[i][j][k]
            if j+1 <= N and k+a <= MAX:
                dp[i+1][j+1][k+a] += dp[i][j][k]
ans = 0
for j in range(1, N+1):
    # 1枚以上取った時の、平均がKになる所 → j枚取って合計がj*Kの所 を合計する
    ans += dp[N][j][j*K]
print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
# 予め-Kした状態で用意しておく
A = [a-K for a in LIST()]

MAX = N * K * 2
# dp[i][k] := i枚目までのカードで、合計をkにする通り数
dp = list2d(N+1, MAX+1, 0)
# 負の数を考慮して、N*K位置を0とする
dp[0][N*K] = 1
for i in range(N):
    a = A[i]
    for k in range(MAX+1):
        dp[i+1][k] += dp[i][k]
        if 0 <= k+a <= MAX:
            dp[i+1][k+a] += dp[i][k]
# N回終わって合計が0になっている通り数 - 1枚も取らないケース
print((dp[N][N*K]-1))
# Original solution
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
# 総和0を平均とするためKを引く
A = [a-K for a in LIST()]

# 半分全列挙
A1 = A[:N//2]
A2 = A[N//2:]

# それぞれの全組み合わせ
P1 = [0]
for S in range(1, 1<<len(A1)):
    p = 0
    for i in range(len(A1)):
        if S & 1<<i:
            p += A1[i]
    P1.append(p)
P2 = [0]
for S in range(1, 1<<len(A2)):
    p = 0
    for i in range(len(A2)):
        if S & 1<<i:
            p += A2[i]
    P2.append(p)

# 総和0になるペアの数を求める
C2 = Counter(P2)
ans = 0
for p in P1:
    ans += C2[-p]
# どちらも1つも選ばない分の1を引く
print((ans - 1))


# Optimized solution
# -*- coding: utf-8 -*-

import sys
from collections import defaultdict

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
# 総和0を平均KとするためKを引く
A = [a-K for a in LIST()]

# dp[i][j] := i番目まで見て、和がjとなる通り数
dp = [defaultdict(int) for i in range(N+1)]
dp[0][0] = 1
for i, a in enumerate(A):
    for k, v in list(dp[i].items()):
        dp[i+1][k] += v
        dp[i+1][k+a] += v
# 部分和が0になった通り数から、1つも選ばない分の1を引く
print((dp[N][0] - 1))
# Original solution
from itertools import combinations
from statistics import mean

n, a = list(map(int, input().split(" ")))
x = tuple(map(int, input().split(" ")))

count = 0
for m in range(1, n+1):
	for nums in combinations(x, m):
		if mean(nums) == a:
			count += 1

print(count)

# Optimized solution
from collections import Counter

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

X = [x-A for x in X]

c = Counter([0])
for x in X:
    d = Counter()
    for k, v in list(c.items()):
        d[k+x] += v
    c += d

print((c[0]-1))
# Original solution
N,A=list(map(int,input().split()))
x=[0]+list(map(int,input().split()))
#print x

max_n=max(x)

#dp=[[[0]*(max_n*N+1) for k in range(N+1)] for j in range(N+1)]
dp=[[[0]*3000 for k in range(51)] for j in range(51)]
#print dp


for j in range(N+1):
	for k in range(N+1):
		for s in range(max_n*N+1):
			if j==k==s==0:
				dp[j][k][s]=1
			elif j>=1 and s<x[j]:
				dp[j][k][s]=dp[j-1][k][s]
			elif j>=1 and k>=1 and s>=x[j]:
				dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j]]
			else:
				dp[j][k][s]=0
#print dp


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=[0]+list(map(int,input().split()))
#print x
y=[i-A for i in x]
#print y

max_x=max(max(x),A)
#print max_x

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

for j in range(N+1):
	for t in range(2*N*max_x):
		if j==0 and t==N*max_x:
			dp[j][t]=1
		elif j>=1 and (t-y[j]<0 or t-y[j]>2*N*max_x):
			dp[j][t]=dp[j-1][t]
		elif j>=1 and t-y[j]>=0 and 2*N*max_x>=t-y[j]: 
			dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j]]
		else:
			dp[j][t]=0

print(dp[N][N*max_x]-1)
# Original solution
from collections import Counter

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

cnt = Counter([0, X[0]])

for x in X[1:]:
    temp = Counter([])
    for k,v in list(cnt.items()):
        temp[k + x] += v
        
    cnt += temp
    
print((cnt[0]-1))
    


# Optimized solution
from collections import Counter

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

l = [ai - a for ai in l]

cnt = Counter([0, l[0]])

for li in l[1:]:
    tmp = Counter([])
    for k,v in list(cnt.items()):
        tmp[k+li] += v
        
    cnt += tmp
    
print((cnt[0]-1))
# Original solution
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,A = inpl()
x = inpl()
dp = [[[0 for _ in range(n+5)] for i in range(3005)] for j in range(n+5)]
dp[0][0][0] = 1
for i in range(n):
    for j in range(sum(x)+1):
        for k in range(n):
            if j >= x[i]:
                dp[i+1][j][k+1] = dp[i][j-x[i]][k] + dp[i][j][k+1]
            else:
                dp[i+1][j][k] = dp[i][j][k]
# for i in range(n+1):
#     print(dp[i][:50])
ans = 0
for j in range(1,sum(x)+1):
    for k in range(1,n+1):
        if j/k == A:
            ans += dp[n][j][k]
print(ans)

# Optimized solution
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,A = inpl()
x = inpl()
nx = n * max(max(x),A)
dp = [[[0 for _ in range(n+5)] for i in range(nx+1)] for j in range(n+5)]
dp[0][0][0] = 1
for i in range(n):
    for j in range(nx+1):
        for k in range(n):
            if j >= x[i]:
                dp[i+1][j][k+1] = dp[i][j-x[i]][k] + dp[i][j][k+1]
            else:
                dp[i+1][j][k] = dp[i][j][k]

ans = 0
for j in range(1,nx+1):
    for k in range(1,n+1):
        if j/k == A:
            ans += dp[n][j][k]
print(ans)
# Original solution
n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
import collections

def Count(j,k,s):
	if(j==0 and k==0 and s==0):
		return 1
	elif(j >= 1 and s < x[j-1]):
		return Count(j-1,k,s)
	elif(j >= 1 and k>=1 and s >= x[j-1]):
		return Count(j-1,k,s) + Count(j-1,k-1,s-x[j-1])
	elif(j < k):
		return 0
	else:
		return 0

sum=0
for i in range(1,n+1):
	sum += Count(n,i,i*a)
print(sum)

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

def Count(n,k,a):
	s = sum(x)
	dp=[[[0 for l in range(s+1)] for j in range(k+1)] for i in range(n+1)]
	dp[0][0][0]=1
	Sum=0
	for i in range(n):
		for j in range(k+1):
			for l in range(s+1):
				if l < x[i]:
					dp[i+1][j][l] = dp[i][j][l]
				if j >=1 and l >= x[i]:
					dp[i+1][j][l] = dp[i][j][l] + dp[i][j-1][l-x[i]]
				if j <= i+1 and l ==j*a and j >= 1:
					if dp[i+1][j][l]>=1:	
						Sum += dp[i+1][j][l]-dp[i][j][l]
	return Sum

print((Count(n,n,a)))
# Original solution
n,a = list(map(int,input().split()))
lst = [int(i) for i in input().split()]
lst.sort()


ans = 0
for i in range(2 ** n):
    bit = format(i,'b')
    bit = bit.rjust(n,'0')
    lcs = 0
    cnt = 0
    for w in range(n):
        if bit[w]=='1':
            lcs += lst[w]
            cnt += 1
    
    if cnt != 0:
        if lcs / cnt == a:
            ans += 1

print(ans)

# Optimized solution
num,ave = list(map(int,input().split()))
numx = list(map(int,input().split()))

L = len(numx)
numy = [0] * L
for i in range(L):
    numy[i] = numx[i] - ave

if abs(min(numy)) < abs(max(numy)):
    maxX = max(numy)
else:
    maxX = abs(min(numy))

dp = [[0]*(2*maxX*L+1) for _ in range(L+1)]
dp[0][maxX*L] = 1
for i in range(L):
    for j in range(2*maxX*L+1):
        if (j-numy[i]) < 0 or (j - numy[i]) > 2*maxX*L:
          dp[i+1][j] = dp[i][j]
        else:
          dp[i+1][j] = dp[i][j] + dp[i][j-numy[i]]
print((dp[L][maxX*L]-1))
# Original solution
# -*- coding:utf-8 -*-
"""解説
dp[j][k][s] := x1,...,xjから k枚選んで xiの合計をsにするような選び方の総数

[@lilium氏]
https://atcoder.jp/contests/abc044/submissions/5887235
"""

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))

    max_x = max(X)
    dp = [[[0 for _ in range(4000+1)] for __ in range(N+1)] for ___ in range(N+1)]

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

    # dp[i][j][k] := i枚のうちj枚を選んで、和がkになる組み合わせ
    """
    dp[i][j][k] := i枚のうち、k枚のカードを選んで、選んだカードの総和がkになる選び方の総数
    i: i枚目のカード
    j: j枚のカードを選んだ
    k: 選んだカードの総和
    """
    for i in range(N):
        for j in range(N):
            for k in range(4000+1):
                if (k+X[i] < 4000+1) :
                    dp[i+1][j][k] += dp[i][j][k]  # i枚目を選ばなかった
                    dp[i+1][j+1][k+X[i]] += dp[i][j][k]  # i枚目を選んだ

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

if __name__ == "__main__":
    solve()


# Optimized solution
# -*- coding:utf-8 -*-

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))

    # dp[i][j] := 左からi+1枚目までにj枚を選んで、選んだカードの総和がkになるカードの選び方
    dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N+1)]
    dp[0][0][0] = 1  # 何も選んでない初期値
    for i in range(0, N):
        for j in range(0, N):
            for k in range(50*50+1):
                #if dp[i][j][k] != 0:
                if 1:
                    dp[i+1][j][k] += dp[i][j][k]  # i枚目を選ばない
                if k-X[i] >= 0:
                    dp[i+1][j+1][k] += dp[i][j][k-X[i]]  # i枚目を選んだ

    ans = 0
    for j in range(1, N+1):  # 1枚以上選ぶ必要がある
        ans += dp[N][j][j*A]
    print(ans)


if __name__ == "__main__":
    solve()
# Original solution
# -*- coding:utf-8 -*-

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))

    dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N+1)]
    dp[0][0][0] = 1  # 何も選んでない初期値

    """
    dp[i][j][k] := 左からi+1枚目までに、j枚のカードを選んで、選んだカードの総和がkになる選び方の総数
    i: 左からi+1枚目のカード
    j: j枚のカードを選んだ
    k: 選んだカードの総和
    """
    for i in range(0, N):
        for j in range(0, N):
            for k in range(50*50+1):
                dp[i+1][j][k] += dp[i][j][k]  # i枚目を選ばない
                if k-X[i] >= 0:
                    dp[i+1][j+1][k] += dp[i][j][k-X[i]]  # i枚目を選んだ

    ans = 0
    for j in range(1, N+1):  # 1枚以上選ぶ必要がある
        ans += dp[N][j][j*A]
    print(ans)


if __name__ == "__main__":
    solve()


# Optimized solution
# -*- coding:utf-8 -*-

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))

    # dp[i][j][k] := 左からi+1枚目までに、j枚を選んで、選んだカードの総和がkになる場合の数
    dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N)]
    dp[0][0][0] = 1
    dp[0][1][X[0]] = 1

    for i in range(1, N):
        for j in range(0, N):
            for k in range(0, 50*50+1):
                dp[i][j][k] += dp[i-1][j][k]  # カードを選ばない
                if k+X[i] < 50*50+1:
                    dp[i][j+1][k+X[i]] += dp[i-1][j][k] # カードを選ぶ
    
    ans = 0
    for j in range(1, N+1):
        ans += dp[N-1][j][A*j]

    print(ans)


if __name__ == "__main__":
    solve()
# Original solution
from itertools import combinations as c

n,a=list(map(int,input().split()))
l=list(map(int,input().split()))
v=0
for i in range(1,n+1):
  v+=sum([1 for j in c(l,i) if sum(j)==a*i])
print(v)

# Optimized solution
n,a=list(map(int,input().split()))
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ 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<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

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

print(s)
# Original solution
n,a=list(map(int,input().split()))
*x,=list(map(int,input().split()))
dp=[[[None]*(n*50+1) for i in range(n+1)] for _ in range(n+1)]

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

print((sum(dp[n][i][i*a] for i in range(1,n+1))))

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

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

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