CodeEff/ECCO huggingface dataset:
# Original solution
N,A=list(map(int, input().split()))
x=list(map(int, input().split()))
dp = [[[0]*(51*51) for _ in range(N+1)] for _ in range(N+1)]
# dp[j][k][s]
for j in range(N+1):
    for k in range(N+1):
        for s in range(51*51):
            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 i in range(1, N+1):
    ans+= dp[N][i][i*A]
print(ans)

# Optimized solution
N,A=list(map(int, input().split()))
x=list(map(int, input().split()))
dp = [[[0]*(51*51) for _ in range(N+1)] for _ in range(N+1)]
# dp[j][k][s]
for j in range(N+1):
    for k in range(j+1):
        for s in range(51*51):
            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 i in range(1, N+1):
    ans+= dp[N][i][i*A]
print(ans)
# Original solution
N, A = list(map(int, input().split()))  # N枚数のカード, 平均をAにしたい
X = tuple(map(int, input().split()))  # N枚のカードの中身

dp = [[[0]*(50*N+1) for _ in range(N+1)] for _ in range(N+1)]

dp[0][0][0] = 1  # 0枚の中から0枚選んで合計が0になる選び方が1通りある

for i in range(N):
    for j in range(N+1):
        for k in range(50*N+1):
            if dp[i][j][k]:  # そのパターン数が0になっている場所からの遷移はありえない！！！
                dp[i+1][j][k] += dp[i][j][k]
                dp[i+1][j+1][k+X[i]] += dp[i][j][k]
ans = 0
for i in range(1, N+1):
    ans += dp[N][i][i*A]
print(ans)


# Optimized solution
N, A = list(map(int, input().split()))  # N枚数のカード, 平均をAにしたい
X = tuple(map(int, input().split()))  # N枚のカードの中身

dp = [[[0]*(50*N+2) for _ in range(N+2)] for _ in range(N+2)]

dp[0][0][0] = 1  # 0枚の中から0枚選んで合計が0になる選び方が1通りある

for i in range(N):
    for j in range(N+1):
        for k in range(50*N+1):
            if dp[i][j][k]:  # ここの分岐が分からん
                dp[i+1][j][k] += dp[i][j][k]
                dp[i+1][j+1][k+X[i]] += dp[i][j][k]
ans = 0
for i in range(1, N+1):
    ans += dp[N][i][i*A]
print(ans)
# Original solution
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
s = [{} for i in range(N+1)]
s[0][0] = 1

for i in range(N):
  cur = X[i]
  for j in range(N, 0, -1):
    for k, v in list(s[j-1].items()):
      s[j][cur + k] = s[j].get(cur + k, 0) + v

ans = 0
for i in range(1, N+1):
  ans += s[i].get(i*A, 0)
print(ans)

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

d = {0: 1}

for cur in X:
  for k, v in list(d.items()):
    d[cur + k] = d.get(cur + k, 0) + v
    
print((d[0]-1))
# Original solution
n,a = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
m,answer = max(max(x),a),0
dp = [[[0]*(n*m+1) for i in range(n+1)] for i in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
	for j in range(n+1):
		for k in range(n*m+1):
			if i>=1 and k<x[i-1]: dp[i][j][k] = dp[i-1][j][k]
			elif i>=1 and j>=1 and k>=x[i-1]: dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]]
for j in range(1,n+1):
	answer += dp[n][j][j*a]
print(answer)

# Optimized solution
n,a = (int(i) for i in input().split())
x = [int(i)-a for i in input().split()]
x = [0]+x
y = max(max(x)+a,a)
dp = [[0 for i in range(2*n*y+1)] for i in range(n+1)]
dp[0][n*y] = 1
for i in range(n+1):
	for j in range(2*n*y+1):
		if i>0 and (j-x[i]<0 or j-x[i]>2*n*y): dp[i][j]=dp[i-1][j]
		elif i>0 and 0<=j-x[i]<=2*n*y: dp[i][j]=dp[i-1][j]+dp[i-1][j-x[i]]
		else: pass
print((dp[n][n*y]-1))
# Original solution
from functools import lru_cache
N, A = list(map(int, input().split()))
X = [int(x) for x in input().split()]

@lru_cache(1000000000, False)
def solve(i, n, s):
    if s < 0:
        return -1
    if N-i+1 < n:
        return -1
    if n == 0:
        if s == 0:
            return 1
        else:
            return -1
    if i == N:
        return -1
    s1 = solve(i+1, n-1,s-X[i])
    s2 = solve(i+1, n, s)
    if s1 == -1 and s2 == -1:
        return -1
    if s1 == -1:
        return s2
    if s2 == -1:
        return s1
    return s1 + s2


answer = 0
for n in range(1, N+1):
    s = solve(0, n, n*A)
    if s != -1:
        #print(n, s)
        answer += s
print(answer)

def test():
    import itertools
    for a in itertools.combinations(X,3):
        if sum(a) == A*3:
            print(a)

# Optimized solution
from functools import lru_cache
N, A = list(map(int, input().split()))
X = [int(x) for x in input().split()]
#with open("9", "w") as f:
#    print(50, 1, file=f)
#    print(*([1]*50), file=f)
assert len(X) == N
def solve0(i, n, s):
    if s < 0:
        return -1
    if N-i+1 < n:
        return -1
    if n == 0:
        if s == 0:
            return 1
        else:
            return -1
    if i == N:
        return -1
    s1 = solve(i+1, n-1,s-X[i])
    s2 = solve(i+1, n, s)
    if s1 == -1 and s2 == -1:
        return -1
    if s1 == -1:
        return s2
    if s2 == -1:
        return s1
    return s1 + s2

cache = {}
def solve(i, n, s):
    key = (i, n, s)
    a = cache.get(key, None)
    if a is None:
        a = solve0(i, n, s)
        cache[key] = a
    return a

answer = 0
for n in range(1, N+1):
    s = solve(0, n, n*A)
    if s != -1:
        answer += s
print(answer)
# Original solution
from itertools import combinations, starmap

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

coefficient = 1  # Aの係数
result = 0
while coefficient <= N:
    for r in range(1, N+1):
        multiple_of_a = coefficient * A
        combis_sums = list(map(sum, combinations(x_list, r)))
        for combi_sum in combis_sums:
            if combi_sum == multiple_of_a:
                result += 1
        coefficient += 1

print(result)

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

max_of_a = N * A

# dp[i][j][k] := i枚目までからj枚取って、合計をkにする通り数
dp = [[[0] * (max_of_a + 1) for _ in range(N+1)]for _ in range(N+1)]
dp[0][0][0] = 1


for i in range(N+1):
    for j in range(N+1):
        for k in range(max_of_a + 1):
            if i >= 1 and x[i-1] > k:
                dp[i][j][k] = dp[i-1][j][k]
            elif i >= 1 and j >= 1 and x[i-1] <= k:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - x[i-1]]

ans = 0
for j in range(1, N+1):
    # N枚(カード総数)の中から1枚以上取った時の、j枚取って合計がj*Aの所 の合計
    ans += dp[N][j][j*A]
print(ans)
# Original solution
from collections import Counter
from copy import copy
N,A = list(map(int,input().split()))
src = list(map(int,input().split()))

dp = [Counter()]
dp[0][0] = 1
for i,a in enumerate(src):
    dp.append(Counter())
    for j in reversed(list(range(i+1))):
        for k,v in list(dp[j].items()):
            dp[j+1][k+a] += v
ans = 0
for i in range(1,N+1):
    ans += dp[i][A*i]
print(ans)


# Optimized solution
from collections import Counter

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

dp = [Counter({0:1})]

for i,a in enumerate(src):
    dp.append(Counter())
    for j in reversed(list(range(i+1))):
        for k,v in list(dp[j].items()):
            dp[j+1][k+a] += v

ans = 0
for i,ctr in enumerate(dp):
    if i==0: continue
    ans += ctr[i*A]
print(ans)
# Original solution
n,a=list(map(int,input().split()))
lists=list(map(int,input().split()))
x=max(lists)
dp=[[[0 for i in range(2602)] for j in range(51)] for _ in range(51)]
dp[0][0][0]=1
#dp[i][j][k] で0からi番目のカードまでのうちで　ｊ枚を選択して、その時に選んだ数の合計がsとなるような方法の総数を刺すことにする
for i in range(n+1):
    for j in range(n+1):
        for k in range(n*x+1):
            if i>=j and i>=1 and k<lists[i-1]:
                dp[i][j][k]=dp[i-1][j][k]
            elif i>=j and j>=1and k>=lists[i-1]:
                dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-lists[i-1]]
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()))
lists=list(map(int,input().split()))

for i in range(n):
    lists[i]-=a
answer=0
dp=[[0 for i in range(5001)] for _ in range(51)]
#dp[i][j]で0からi枚目まで好きなように選択してそのそうわがｊ-2500となるような撮り方の総数
#最終的に求めるのはdp[i][0]である

for i in range(n+1):
    for j in range(4951):
        if i>=1 and j>=lists[i-1]:
            dp[i][j]=dp[i-1][j-lists[i-1]]+dp[i-1][j]
        if i>=1 and j<lists[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            if j==2500 and i==0:
                dp[i][j]=1
            elif j!=2500 and i==0:
                dp[i][j]=0
print((dp[n][2500]-1))
# Original solution
N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
maxn = max(max(X), A)

dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1

for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] <= 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]

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


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

dp = [[0] * (2 * N * maxn + 1) for _ in range(N + 1)]
dp[0][N * maxn] = 1

for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] <= 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]

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

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


noz=[x-a for x in cards].count(0)
pl=[x-a for x in cards if x-a>0]
nl=[a-x for x in cards if x-a<0]
sl=[pl,nl][len(nl)<=len(pl)]
ll=[pl,nl][len(pl)<len(nl)]

sl.sort()
ll.sort()

sumfunc = lambda n, l: sum([l[x]*((n>>x)&1) for x in range(len(l))])

sumsl=[0 for _ in range(sum(sl))]
sumll=[0 for _ in range(sum(ll))]

for i in range(1,2**len(sl)):
    sumsl[sumfunc(i,sl)-1]+=1

for i in range(1,2**len(ll)):
    sumll[sumfunc(i,ll)-1]+=1

count=sum([x*y for x,y in zip(sumsl, sumll)])
# count=0
# p=sum([not sumsl[-1]<sumfunc(2**i,ll) for i in range(1,len(ll)+1)])
# q=sum([sumsl[0]>=sumfunc(2**i-1,ll) for i in range(1,len(ll)+1)])
# count=[sumfunc(j,ll) in sumsl for j in range(2**q-1,2**p)].count(True)

print(((count+1)*(2**noz)-1))


# Optimized solution
import sys

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

integers=[x-a for x in cards]
cards.append(a)
f=max(cards)*n


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

for y in range(n+1):
    for x in range(2*f+1):
        if y==0 and x==f:
            dp[x][y]=1
        elif y>0 and (x-integers[y-1]<0 or x-integers[y-1]>2*f):
            dp[x][y]=dp[x][y-1]
        elif y>0 and x-integers[y-1]>=0 and x-integers[y-1]<=2*f:
            dp[x][y]=dp[x-integers[y-1]][y-1]+dp[x][y-1]
        else:
            dp[x][y]=0
print((dp[f][n]-1))
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))

dp = [[[0] * (50 * (n + 10)) for _ in range(n + 10)] for _ in range(n + 10)]
dp[0][0][0] = 1

for i in range(n):
    for use in range(n):
        for total in range(n * a):
            dp[i + 1][use][total] += dp[i][use][total]
            dp[i + 1][use + 1][total + x[i]] += dp[i][use][total]

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()))

dp = [[[0] * (50 * (n + 10)) for _ in range(n + 10)] for _ in range(n + 10)]
dp[0][0][0] = 1

for i in range(n):
    for use in range(n):
        for total in range(n * a):
            if dp[i][use][total]:
                dp[i + 1][use][total] += dp[i][use][total]
                dp[i + 1][use + 1][total + x[i]] += dp[i][use][total]

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

print(ans)
# Original solution
from collections import Counter

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

for i in range(n):
    x[i]-=a
    
left=x[:n//2]
l=len(left)
right=x[n//2:]
r=len(right)

data_left=Counter()
data_right=Counter()

for i in range(1,2**l):
    num=0
    for j in range(l):
        if (i>>j)&1==1:
            num+=left[j]
    data_left[-num]+=1

for i in range(1,2**r):
    num=0
    for j in range(r):
        if (i>>j)&1==1:
            num+=right[j]
    data_right[num]+=1

ans=data_left[0]+data_right[0]
for u,v in list(data_left.items()):
    ans+=data_right[u]*v
    
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]*(2*n*50+2)
dp[0]=1
for i in range(n):
    h=dp[:]
    for j in range(-(n-1)*50,(n-1)*50+1):
        h[j]+=dp[j-x[i]]
    dp=h
print((dp[0]-1))
# Original solution
import itertools as itr
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))

#print(n,a)
#print(x)

cnt=0
for i in range(1,n+1):
    for y in itr.combinations(x,i):
        #print(y)
        if sum(y) == i*a:
            cnt += 1
print(cnt)

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  5 12:20:16 2018
ABC44C
@author: maezawa
"""

def f(i, j):
    global xa
    global dp
    if i==0:
        cnt = 0
        if j==0:
            cnt += 1
        if j==xa[0]:
            cnt += 1
        return cnt
    if (i, j) in dp:
        return dp[(i,j)]
    else:
        dp[(i,j)] = f(i-1,j-xa[i]) + f(i-1,j)
        #print(i,j, dp[(i,j)])
        return dp[(i,j)]


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

xa = [x[i]-a for i in range(n)]
dp = dict([])

print((f(n-1, 0)-1))
# Original solution
from collections import Counter

n,a = list(map(int,input().split()))
x = [int(i)-a for i in input().split()]

dp = [Counter()]
# [何個使ったか][sum]
dp[0][0] = 1
for i,j in enumerate(x):
	dp.append(Counter())
	for k in reversed(list(range(i+1))):
		for m,n in list(dp[k].items()):
			dp[k+1][m+j] += n

res = 0
for l in dp:
	res += l[0]
print((res-1))

# Optimized solution
from collections import Counter

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

dp = [Counter()]
# [何個使ったか][sum]
dp[0][0] = 1
for i,j in enumerate(x):
	dp.append(Counter())
	for k in reversed(list(range(i+1))):
		for m,p in list(dp[k].items()):
			dp[k+1][m+j] += p

res = 0
for i in range(1,n+1):
	res += dp[i][i*a]
print(res)
# Original solution
from collections import defaultdict


n, k = list(map(int, input().split()))

arr = list(map(int, input().split()))

arr = [x - k for x in arr]
arr.sort()

arr_minus = [-x for x in arr if x < 0]
arr_zero = sum(x==0 for x in arr)
arr_plus = [x for x in arr if x > 0]

minus_nums = defaultdict(int)

for i in range(1, 2 ** len(arr_minus)):
    bin_minus = "{:050b}".format(i)[::-1]
    item = sum(x for idx, x in enumerate(arr_minus) if bin_minus[idx] == "1")
    minus_nums[item] += 1

cnt = 0
for i in range(1, 2 ** len(arr_plus)):
    bin_plus = "{:050b}".format(i)[::-1]
    item = sum(x for idx, x in enumerate(arr_plus) if bin_plus[idx] == "1")
    cnt += minus_nums[item]

print(((1 + cnt) * 2 ** arr_zero - 1))

# Optimized solution
from collections import defaultdict

n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr = [x - k for x in arr]

dct = defaultdict(int)
dct[0] = 1

for x in arr:
    for k, v in list(dct.items()):
        dct[k + x] += v

print((dct[0] - 1))
# Original solution
N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
dp = [0] * 3000 + [1] + [0] * 3000
for x in X:
    dp_old = dp.copy()
    for i in range(max(-x, 0), min(6001, 6001 - x)):
        dp[i + x] += dp_old[i]
print((dp[3000] - 1))


# Optimized solution
N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
M = max(X + [A])
dp = [0] * (2 * N * M + 1)
dp[N * M] = 1
for x in X:
    dp_old = dp.copy()
    for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)):
        dp[i + x] += dp_old[i]
print((dp[N * M] - 1))
# Original solution
N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_plus = len(X_plus)
l_minus = len(X_minus)
l_zero = len(X) - l_plus - l_minus
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = [1] + [0] * s_plus
dp_minus = [1] + [0] * s_minus
for i in range(l_plus):
    dp_plus_old = dp_plus.copy()
    for j in range(s_plus + 1 - X_plus[i]):
        dp_plus[j + X_plus[i]] += dp_plus_old[j]
for i in range(l_minus):
    dp_minus_old = dp_minus.copy()
    for j in range(s_minus + 1 - X_minus[i]):
        dp_minus[j + X_minus[i]] += dp_minus_old[j]
c_zero = 2 ** l_zero
ans = c_zero - 1
for j in range(1, min(s_plus, s_minus) + 1):
    ans += c_zero * dp_plus[j] * dp_minus[j]
print(ans)


# Optimized solution
N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_zero = len(X) - len(X_plus) - len(X_minus)
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = {0: 1}
dp_minus = {0: 1}
for p in X_plus:
    dp_plus_old = dp_plus.copy()
    for k, v in list(dp_plus_old.items()):
        dp_plus[k + p] = dp_plus_old.get(k, 0) + dp_plus_old.get(k + p, 0)
for m in X_minus:
    dp_minus_old = dp_minus.copy()
    for k, v in list(dp_minus_old.items()):
        dp_minus[k + m] = dp_minus_old.get(k, 0) + dp_minus_old.get(k + m, 0)
c_zero = 2 ** l_zero
ans = c_zero - 1
for j in range(1, min(s_plus, s_minus) + 1):
    ans += c_zero * dp_plus.get(j, 0) * dp_minus.get(j, 0)
print(ans)
# Original solution
import collections
import itertools
import functools


@functools.lru_cache(maxsize=100000000)
def sigma(s):
    return sum(k * v for k, v in s)


def main():
    n, a = list(map(int, input().split()))
    x = list(map(int, input().split()))

    d = collections.defaultdict(int)
    d[0] = 1

    for c in x:
        current = list(d.items())
        for diff, count in current:
            delta = diff + c - a
            d[delta] = d[delta] + count

    print((d[0] - 1))


if __name__ == '__main__':
    main()


# Optimized solution
import collections


def main():
    n, a = list(map(int, input().split()))
    x = list(map(int, input().split()))

    d = collections.defaultdict(int)
    d[0] = 1

    for c in x:
        current = list(d.items())
        for diff, count in current:
            delta = diff + c - a
            d[delta] = d[delta] + count

    print((d[0] - 1))


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

dp = [defaultdict(int) for _ in range(n+1)]
dp[0][a] += 1

for i, x_i in enumerate(x):
    for p in list(dp[i].keys()):
        pk = p + a - x_i
        dp[i+1][pk] += dp[i][p]
        dp[i+1][p] += dp[i][p]

print((dp[n][a] - 1))

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

x.sort()
x = [i - a for i in x]
# print(x)
D = {0 : 1}
for i in x:
    for j, k in list(D.items()):
        D[i+j] = D.get(i+j, 0) + k

    # print(D)
print((D[0] - 1))
# Original solution
N,A = list(map(int,input().split()))
L = list(map(int,input().split()))
#for i in range(N) :
#    L[i] -= A
#L = sorted(L)
ans = 0
for bit in range(1 << N) :
    calc = 0
    ctr = 0
    for k in range(N) :
        if bit & (1 << k) :
            calc += L[k]
            ctr += 1
    if calc == 0 :
        continue
    if calc == A*ctr :
        ans += 1
print(ans)


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

X = list(map(int,input().split()))

ma = max(X)

dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]

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

for i in range(1,N+1) :
    for k in range(i+1) :
        for s in range(ma*N+1) :
            if (k >= 1) and (s >= X[i-1]) :
                dp[i][k][s] = dp[i-1][k][s] + dp[i-1][k-1][s-X[i-1]]
            else :
                dp[i][k][s] = dp[i-1][k][s]

ans = 0

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

print(ans)
# Original solution
iN,iA =[int(x) for x in input().split()]
#aX = [int(x) - iA for x in input().split()]
aX = [int(x) for x in input().split()]

#解法1
#すげーな動的計画法
iMX = max(aX + [iA])
dp = [[[0]*(iN*iMX + 1) for _ in range(iN+1)] for _ in range(iN + 1)]

dp[0][0][0] = 1
for j in range(1,iN+1):
    for k in range(0,iN+1):
        for s in range(0,iN*iMX + 1):
            if  s < aX[j-1]:
                dp[j][k][s] = dp[j-1][k][s]
            elif k >= 1 and  s >= aX[j-1]:
                dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s- aX[j-1]]
            else:
                dp[j][k][s] = 0
iRet = 0
for k in range(1,iN+1):
    iRet += dp[iN][k][k*iA]
print(iRet)


# Optimized solution
iN,iA =[int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]

#解法2

iMX = max(aX + [iA])
dp = [[0]*(2 * iN*iMX + 1) for _ in range(iN+1)]

for j in range(0,iN+1):
    for t in range(0,2*iN*iMX):
        if j == 0 and t == iN * iMX :
            dp[j][t] = 1
        elif j >= 0 and ( t - aX[j-1] < 0 or t - aX[j-1] > 2*iN*iMX):
            dp[j][t] = dp[j-1][t]
        elif j >= 0 and ( 0 <= t - aX[j-1] <= 2*iN*iMX):
            dp[j][t] = dp[j-1][t] + dp[j-1][t-aX[j-1]]
        else:
            dp[j][t] = 0
print((dp[iN][iN*iMX] -1 ))
# Original solution
iN,iA =[int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]

#解法2

iMX = max(aX + [iA])
dp = [[0]*(2 * iN*iMX + 1) for _ in range(iN+1)]

for j in range(0,iN+1):
    for t in range(0,2*iN*iMX):
        if j == 0 and t == iN * iMX :
            dp[j][t] = 1
        elif j >= 0 and ( t - aX[j-1] < 0 or t - aX[j-1] > 2*iN*iMX):
            dp[j][t] = dp[j-1][t]
        elif j >= 0 and ( 0 <= t - aX[j-1] <= 2*iN*iMX):
            dp[j][t] = dp[j-1][t] + dp[j-1][t-aX[j-1]]
        else:
            dp[j][t] = 0
print((dp[iN][iN*iMX] -1 ))


# Optimized solution
iN,iA =[int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]

#解法2そのまま

iMX = max(aX + [iA])
iULim = iN*iMX
iULim2 = 2*iULim

#y0..yjから0枚以上選んだ合計をt-iN*iMXにするような選び方の総数
dp = [[0]*(iULim2 + 1) for _ in range(iN+1)]
for j in range(0,iN+1):
    for t in range(0,iULim2):
        if j == 0 and t == iULim :
            dp[j][t] = 1
        elif  t - aX[j-1] < 0 or t - aX[j-1] > iULim2:
            dp[j][t] = dp[j-1][t]
        elif  0 <= t - aX[j-1] <= iULim2:
            dp[j][t] = dp[j-1][t] + dp[j-1][t-aX[j-1]]
        else:
            dp[j][t] = 0
print((dp[iN][iN*iMX] -1 ))