CodeEff/ECCO huggingface dataset:
# Original solution
N, A = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
sumx = sum(x)
DP = [[[0] * (N+1) for i in range(sumx+1)] for i in range(N+1)]
DP[0][0][0] = 1
for i in range(N):
    for j in range(sumx+1):
        for k in range(N):
            if j - x[i] >= 0:
                DP[i+1][j][k+1] += DP[i][j-x[i]][k]
            DP[i+1][j][k] += DP[i][j][k]

res = 0
for i in range(1,N+1):
    if i * A <= sumx:
        res += DP[N][i * A][i]
print(res)

# Optimized solution
N, A = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
sumx = sum(x)
DP = [[[0] * (N+1) for i in range(sumx+1)] for i in range(N+1)]
DP[0][0][0] = 1
for i in range(N):
    for j in range(sumx+1):
        for k in range(i+1):
            if j - x[i] >= 0:
                DP[i+1][j][k+1] += DP[i][j-x[i]][k]
            DP[i+1][j][k] += DP[i][j][k]

res = 0
for i in range(1,N+1):
    if i * A <= sumx:
        res += DP[N][i * A][i]
print(res)
# Original solution
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    # dp[i][j][k] := patterns to make k with j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 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(N * 50 + 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 = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple([int(x) - A for x in input().split()])
    D = {0: 1}
    for i in X:
        for j, k in list(D.items()):
            D[i + j] = D.get(i + j, 0) + k
    ans = D[0] - 1
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
from collections import Counter


def inpl():
    return list(map(int, input().split()))


N, A = inpl()
X = inpl()
cX = Counter(X)

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

dp[0][0][0] = 1
for i in range(1, N + 1):
    x = X[i - 1]
    for j in range(i + 1):
        for k in range(N * max(X) + 1):
            # print(i, j, k)
            if j == i and k - x < 0:
                dp[i][j][k] = 0
            elif j == i and k - x >= 0:
                dp[i][j][k] = dp[i - 1][j - 1][k - x]
            elif k - x < 0 or j == 0:
                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 - x]

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


# Optimized solution
def inpl():
    return list(map(int, input().split()))


N, A = inpl()
X = inpl()
maxX = max(X)

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

dp[0][0][0] = 1
for i in range(N):
    x = X[i - 1]
    for j in range(i + 1):
        for k in range(N * maxX + 1):
            # print(i, j, k)
            if dp[i][j][k] == 0:
                continue
            dp[i + 1][j][k] += dp[i][j][k]
            dp[i + 1][j + 1][k + x] += dp[i][j][k]

ans = 0
for j in range(1, N + 1):
    if j * A > N * maxX:
        continue
    ans += dp[N][j][j * A]
print(ans)
# Original solution
N,A = list(map(int,input().split()))
X = [int(x)-A for x in input().split()]

z = 0 
dic = {}

for x in X:
    if x==0:
        z += 1
    else:
        dic[x] = dic.get(x,0) + 1
            
line = {}
line[0] = 1

for k in dic:    
    line_k = {}
    for i in range(dic[k]+1):
        line_k[k*i] = 1      
        for j in range(dic[k],dic[k]-i,-1):
            line_k[k*i] *= j
        for j in range(1,1+i):
            line_k[k*i] //= j
    line_tmp = {}
    for k_lk in line_k:
        for k_l in line:
            line_tmp[k_lk+k_l] = line_tmp.get(k_lk+k_l,0) + line_k[k_lk] * line[k_l]
    line = line_tmp.copy()
    
print((line[0] * (2**z) -1)) 


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

d = {0:1}  

for x in X:
    d_tmp = d.copy()
    for k in d_tmp:        
        d[k+x] = d.get(k+x,0)+d_tmp[k]
print((d[0]-1))
# Original solution
import sys
import itertools
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: list(map(int, read().split()))


def main():

    N, A = in_nn()
    X = in_nl()

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

    N1 = N // 2
    N2 = N - N1

    comb1 = itertools.product(list(range(2)), repeat=N1)
    comb2 = itertools.product(list(range(2)), repeat=N2)

    d1 = defaultdict(int)
    d2 = defaultdict(int)

    for comb in comb1:
        sum = 0
        for i, c in enumerate(comb):
            if c == 1:
                sum += X[i]
        d1[sum] += 1

    for comb in comb2:
        sum = 0
        for i, c in enumerate(comb):
            if c == 1:
                sum += X[N1 + i]
        d2[sum] += 1

    ans = 0
    for k, v in list(d1.items()):
        ans += v * d2[-k]

    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: list(map(int, read().split()))


def main():
    N, A = in_nn()
    X = in_nl()
    X = [x - A for x in X]

    dp = [0] * 5050
    dp[2525] = 1

    for i in range(N):

        next_dp = copy.copy(dp)
        for t in range(5050):
            if X[i] + t < 5050:
                next_dp[X[i] + t] += dp[t]

        dp = next_dp

    print((dp[2525] - 1))


if __name__ == '__main__':
    main()
# Original solution
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: list(map(int, read().split()))


def main():
    N, A = in_nn()
    X = in_nl()
    X = [x - A for x in X]

    dp = [0] * 5050
    dp[2525] = 1

    for i in range(N):

        next_dp = copy.copy(dp)
        for t in range(5050):
            if X[i] + t < 5050:
                next_dp[X[i] + t] += dp[t]

        dp = next_dp

    print((dp[2525] - 1))


if __name__ == '__main__':
    main()


# Optimized solution
import sys
import copy

readline = sys.stdin.buffer.readline


def main():
    N, A = list(map(int, readline().split()))
    X = list(map(int, readline().split()))
    X = [x - A for x in X]

    dp = [0] * 5050
    dp[2525] = 1

    for i in range(N):

        next_dp = copy.copy(dp)
        for t in range(5050):
            if X[i] + t < 5050:
                next_dp[X[i] + t] += dp[t]

        dp = next_dp

    print((dp[2525] - 1))


if __name__ == '__main__':
    main()
# Original solution
MAX=2500
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
# dp[i][j][k] := x[0:i]のカードからj枚とって合計がkとなる取り方の数
dp = [[[0] * (MAX+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(0,n+1):
    for k in range(0, MAX+1):
      dp[i+1][j][k] += dp[i][j][k] # i番目のカードを取らない
  for j in range(0,n):
    for k in range(0, MAX+1-x[i]):
      dp[i+1][j+1][k+x[i]] += dp[i][j][k] # i番目のカードを取る

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


# Optimized solution
MAX=2500
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
# dp[i][j][k] := x[0:i]のカードからj枚とって合計がkとなる取り方の数
dp = [[[0] * (MAX+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(0,n+1):
    for k in range(0, MAX+1):
      dp[i+1][j][k] += dp[i][j][k] # i番目のカードを取らない
  for j in range(1,n+1):
    for k in range(x[i], MAX+1):
      dp[i+1][j][k] += dp[i][j-1][k-x[i]] # i番目のカードを取る

ans = 0
for i in range(1,n+1):
  ans += dp[n][i][a*i]
print(ans)
# Original solution
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]

table = [[[0]*(N*A+1) for i in range(N+1)] for j in range(N+1)]
table[0][0][0] = 1

for j in range(1,N+1):
  for k in range(N+1):
    for s in range(N*A+1):
      c = x[j-1]
      if s-c<0:
        table[j][k][s] = table[j-1][k][s]
      elif s-c>=0 and k>=1:
        table[j][k][s] = table[j-1][k][s] + table[j-1][k-1][s-c]
      
ans = 0
for i in range(1,N+1):
  ans += table[N][i][i*A]
print(ans)

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

table = [[[0]*(N*A+1) for i in range(N+1)] for j in range(N+1)]
table[0][0][0] = 1

for j in range(1,N+1):
  for k in range(j+1):
    for s in range(N*A+1):
      c = x[j-1]
      if s-c<0:
        table[j][k][s] = table[j-1][k][s]
      elif s-c>=0 and k>=1:
        table[j][k][s] = table[j-1][k][s] + table[j-1][k-1][s-c]
      
ans = 0
for i in range(1,N+1):
  ans += table[N][i][i*A]
print(ans)
# Original solution
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
ans = 0

dp = [[[0]*(50*N+1) for j in range(N+1)] for k in range(N+1)]
dp[0][0][0] = 1 
for j in range(1,N+1):
  for k in range(N+1):
    for s in range(50*N+1):
      dp[j][k][s] = dp[j-1][k][s]
      if s>=x[j-1]:
        dp[j][k][s] += dp[j-1][k-1][s-x[j-1]]
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= [int(i) for i in input().split()]
X = max(x)
dp = [[[0]*(X*N+1) for i in range(N+1)] for j in range(N+1)]
dp[0][0][0] = 1
ans = 0

for j in range(1,N+1):
  for k in range(j+1):
    for s in range(X*N+1):
      dp[j][k][s] = dp[j-1][k][s]
      if s >= x[j-1]:
        dp[j][k][s] += dp[j-1][k-1][s-x[j-1]]
      
for i in range(N+1):
  ans += dp[-1][i][i*A]
  if (i+1)*A > X*N:
    break
print((ans-1))
# Original solution
n, A = list(map(int,input().split()))
x = list(map(int,input().split()))

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


for i in range(n):
    for k in range(n):
        for s in range(sum(x)+1):
                dp[i+1][k][s] += dp[i][k][s]
                dp[i+1][k+1][s+x[i]] += dp[i][k][s]

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 = [list( [0 for _ in range(3000)] for _ in range(n+1)) for _ in range(n+1)]
dp[0][0][0] = 1


for i in range(n):
    for k in range(n):
        for s in range(sum(x)+1):
                dp[i+1][k][s] += dp[i][k][s]
                dp[i+1][k+1][s+x[i]] += dp[i][k][s]

ans = 0
for i in range(1,n+1):
    ans += dp[n][i][A*i]
print(ans)
# Original solution
n, a =list(map(int, input().split()))
x=list(map(int, input().split()))
x=[i-a for i in x]
memo=[[-1]*6000 for i in range(60)]
def dp(k, value):
    if k==n:
        if value==0:
            return 1
        else:
            return 0
    if memo[k][value]>0:
        return memo[k][value]
    memo[k][value]=dp(k+1, value+x[k])+dp(k+1, value)
    return memo[k][value]
print((dp(0, 0)-1))

# Optimized solution
n, a =list(map(int, input().split()))
x=list(map(int, input().split()))
x=[i-a for i in x]
memo=[[-1]*6000 for i in range(60)]
def dp(k, value):
    if k==n:
        if value==0:
            return 1
        else:
            return 0
    if memo[k][value]>=0:
        return memo[k][value]
    memo[k][value]=dp(k+1, value+x[k])+dp(k+1, value)
    return memo[k][value]
print((dp(0, 0)-1))
# Original solution
N, A = list(map(int, input().split(' ')))

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

from collections import defaultdict
counter = defaultdict(int)
counter[0] = 1

for x in X:
	copy = dict(counter)
	for d,c in list(copy.items()):
		counter[d+x] += c

print((counter[0]-1))

# Optimized solution

from collections import defaultdict
N, A = list(map(int, input().split()))

X = [int(s) - A for s in input().split()]

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

for x in X:
  for d,c in list(counter.items()):
    counter[d+x] += c

print((counter[0]-1))
# Original solution
n,a=list(map(int,input().split()))
X=list(map(int,input().split()))

dp=[[[0]*(sum(X)+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0]=1

for i in range(1,n+1): #x_1,x_2...x_n
  for k in range(i):   #k枚数選ぶ
    for j in range(sum(X)+1): #合計
      if dp[i-1][k][j]:
        dp[i][k+1][j+X[i-1]]+=dp[i-1][k][j]
        dp[i][k][j]+=dp[i-1][k][j]
ans=0
for i in range(1,n+1):
  for j in range(1,sum(X)+1):
    if j==i*a:
      ans+=dp[n][i][j]
print(ans)

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

dp=[[[0]*(sum(X)+1) for _ in range(n+1)] for _ in range(n+1)]

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

for i in range(1,n+1): #x_1,x_2...x_n
  for k in range(i):   #k枚数選ぶ
    for s in range(sum(X)+1): #合計
      if dp[i-1][k][s]:
        dp[i][k+1][s+X[i-1]]+=dp[i-1][k][s] #1枚選択肢が増えた時の、そのカードを加えた結果を加算
        dp[i][k][s]+=dp[i-1][k][s]
ans=0
for i in range(1,n+1):
  for j in range(1,sum(X)+1):
    if j == i*a: #合計が平均のi倍の時に加える
      ans+=dp[n][i][j]

print(ans)
# Original solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict
from copy import copy
def resolve():
    n,a=list(map(int,input().split()))
    X=list([int(x)-a for x in input().split()])
    dp=defaultdict(int)
    dp[0]=1
    for x in X:
        ndp=copy(dp)
        for key,val in list(dp.items()):
            ndp[key+x]+=val
        dp=ndp

    print((dp[0]-1))
resolve()

# Optimized solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
    n,a=list(map(int,input().split()))
    dp=defaultdict(int)
    dp[0]=1

    for x in map(int,input().split()):
        x-=a
        ndp=dp.copy()
        for key,val in list(dp.items()):
            ndp[key+x]+=val
        dp=ndp

    print((dp[0]-1))
resolve()
# Original solution
N, A = list(map(int,input().split()))
X = list(map(int,input().split()))

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

dp[0][0][0] = 1
for i in range(1, N+1):
    for j in range(N+1):
        for k in range(50*N+1):
            dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[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()))
X = list(map(int,input().split()))
dp = [[[0 for _ in range(50*N + 1)] for _ in range(N+1)] for _ in range(N+1)]

dp[0][0][0] = 1
for i in range(1, N+1):
    for j in range(i+1):
        for k in range(50*N+1):
            dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

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

dp[0][0][0] = 1
for i in range(1, N+1):
    for j in range(i+1):
        for k in range(50*N+1):
            dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[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()))
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
for i in range(1, N+1):
    for j in range(i+1):
        for k in range(50*j+1):
            dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

ans = 0
for i in range(1, N+1):
    ans += dp[N][i][A * i]
print(ans)
# Original solution
N, A = list(map(int, input().split()))
X = list([int(x)-A for x in input().split()])
X_MAX = max(max(X), -min(X))
NX = N * X_MAX
dp = [[[0] * (N+1)  for i in range(N+1)] for _ in range(NX * 2 + 1)]
dp[NX][0][0] = 1
for i in range(1, N+1):
    for j in range(0, i+1):
        for k in range(NX * 2 + 1):
            if k == NX and j == 0:
                dp[k][i][j] = 1
                continue
            dp[k][i][j] += dp[k][i-1][j]
            if 0 <= k - X[i-1] < NX * 2 + 1:
                dp[k][i][j] += dp[k-X[i-1]][i-1][j-1]

print((sum(dp[NX][N]) - 1))

# Optimized solution
N, A = list(map(int, input().split()))
X = list([int(x)-A for x in input().split()])
X_MAX = max(max(X), -min(X))
NX = N * X_MAX
dp = [[0] * (X_MAX * (N+1) * 2 + 1)  for i in range(N+1)]
dp [0][NX] = 1
for i in range(1, N+1):
    for j in range(NX*2+1):
        dp[i][j] += dp[i-1][j]
        dp[i][j] += dp[i-1][j-X[i-1]]

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

X = max(max(x), a)

dp = [[[0 for s in range(n*X+1)] for k in range(n+1)] for j in range(n+1)]

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

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

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


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

offset = 300
dp = [[0]*600 for _ in range(n+1)]
dp[0][offset] = 1
for i in range(1,n+1):
    x = xl[i-1]-a
    for j in range(-300,300):
        dp[i][offset+j] = dp[i-1][offset+j]
        if 600>offset+j-x>=0:
            dp[i][offset+j] += dp[i-1][offset+j-x]

print((dp[n][offset]-1))
# Original solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
dp=[[[0 for i in range(2501)] for j in range(n+1)] for k in range(n+1)]
#dp[i][j][k]:=i枚目まで見てj枚選んで和がkとなるようなカードの取り方の数
dp[0][0][0]=1
for i in range(n):
    see=x[i]
    for j in range(i+2):
        for k in range(2501):
            dp[i+1][j][k]+=dp[i][j][k]
            if see>k or j==0:continue
            dp[i+1][j][k]+=dp[i][j-1][k-see]
ans=0
for i in range(1,n+1):
    ans+=dp[-1][i][i*a]
print(ans)

# Optimized solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
dp=[[[0 for i in range(2501)] for j in range(k+2)] for k in range(n+1)]
#dp[i][j][k]:=i枚目まで見てj枚選んで和がkとなるようなカードの取り方の数
dp[0][0][0]=1
for i in range(n):
    see=x[i]
    for j in range(i+2):
        for k in range(2501):
            dp[i+1][j][k]+=dp[i][j][k]
            if see>k or j==0:continue
            dp[i+1][j][k]+=dp[i][j-1][k-see]
ans=0
for i in range(1,n+1):
    ans+=dp[-1][i][i*a]
print(ans)
# Original solution
def main():
    N, A = list(map(int, input().split()))
    x = list(map(int, input().split()))

    x.insert(0, 0)

    dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ 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 * A + 1):
                dp[i][j][k] = dp[i - 1][j][k]
                if k >= x[i]:
                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i]]

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

    print(ans)


if __name__ == '__main__':
    main()


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

    x.insert(0, 0)

    dp = [[[0] * (N * A + 1) for _ in range(N + 1)] for _ 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 * A + 1):
                dp[i][j][k] = dp[i - 1][j][k]
                if k >= x[i]:
                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i]]

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

    print(ans)


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

    x.insert(0, 0)

    dp = [[[0] * (N * A + 1) for _ in range(N + 1)] for _ 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 * A + 1):
                dp[i][j][k] = dp[i - 1][j][k]
                if k >= x[i]:
                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i]]

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

    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N, A = list(map(int, input().split()))
    x = [0]
    x.extend(list(map(int, input().split())))

    dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ 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 * A + 1):
                if k < x[i]:
                    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 - x[i]]

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

    print(ans)


if __name__ == '__main__':
    main()
# Original solution
N,A=list(map(int,input().split()))
x=list(map(int,input().split()))
dp=[[[0 for i in range(50*50+1)] for j in range(N+1) ]for k in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
  for j in range(N+1):
    for k in range(50*50+1):
      dp[i][j][k]=dp[i-1][j][k]
      if x[i-1]<= k and j>0: dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]]
ans=0
for j in range(1,N+1):
  ans+=dp[N][j][j*A]
print(ans)

# Optimized solution
N,A=list(map(int,input().split()))
x=list(map(int,input().split()))
X=max(max(x),A)
y=[x[i]-A for i in range(N)]
dp=[[0 for i in range(2*N*X+1)] for j in range(N+1)]
dp[0][N*X]=1
for j in range(1,N+1):
  for k in range(2*N*X+1):
    dp[j][k]=dp[j-1][k]
    if 0<= k-y[j-1] and k-y[j-1]<=2*N*X:
      dp[j][k]+=dp[j-1][k-y[j-1]]
print((dp[N][N*X]-1))