CodeEff/ECCO huggingface dataset:
# Original solution
n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
cnt = 0
for i in range(1 << n):
    ans=[]
    for j in range(n):
        if (i >> j) & 1:
            ans.append(x[j])
    if ans and sum(ans)/len(ans) == a:
        cnt+=1
print(cnt)

# Optimized solution
N,A = list(map(int,input().split()))
X = list(map(int,input().split()))
Y = [x-A for x in X]
dp = {0:1}

for y in Y:
  tmp = list(dp.items())
  for k,v in tmp:
    dp[k+y]=dp.get(k+y,0)+v

print((dp[0]-1))
# Original solution
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
from collections import defaultdict


def main():
    N, A, *X = list(map(int, open(0).read().split()))
    X, D = [i - A for i in X], defaultdict(int)
    D[0] = 1
    for i in X:
        for j, k in list(D.items()):
            D[i + j] += k
    ans = D[0] - 1
    print(ans)
    


if __name__ == "__main__":
    main()

# Optimized solution
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A, *X = list(map(int, open(0).read().split()))
    X, D = [i - A for i in X], {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
n, a = list(map(int, input().split()))
xlist = list(sorted(map(int, input().split())))

maxx = xlist[-1] if xlist[-1] > a else a
# dp[j][k][s]: x_1...x_jまでのなかからk枚選んで合計をsにする総数
dp = [[[0 for _ in range(maxx * n + 1)] for _ in range(n + 1)] for _ in range(n + 1)]

dp[0][0][0] = 1  # 0枚選んで合計を0にするのは1通り
for j in range(n + 1):
  for k in range(n + 1):
    for s in range(maxx * k + 1):
      if j >= 1 and s < xlist[j-1]:  # x_0は選ばないのと同じなので0のまま更新しない
        dp[j][k][s] = dp[j-1][k][s]
      elif j >= 1 and k >= 1 and s >= xlist[j-1]:
        dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-xlist[j-1]]

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

maxx = max(x)
maxx = max(maxx, a)
# dp[j][k][s] : j枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(maxx * n + 1)] for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1

for j in range(n + 1):
    for k in range(j + 1):
        for s in range(maxx * k + 1):
            if 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]]

ans = 0
for k in range(1, n + 1):
    ans += dp[n][k][k*a]
print(ans)
# Original solution
def count_up(N, A, x, check, card, total):
  if check == N:
    return 1 if card > 0 and card * A == total else 0
  else:
    return count_up(N, A, x, check+1, card+1, total+x[check]) + count_up(N, A, x, check+1, card, total)

def bad_method(N, A, x):
  print(count_up(N, A, x, 0, 0, 0))

def well_method(N, A, x):
  dp = [[[1 for a in range(N*50)] for b in range(N+1)] for c in range(N+1)]
  for j in range(N+1):
    for k in range(N+1):
      for s in range(N*50):
        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

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

line = input().split()
N = int(line[0])
A = int(line[1])
line = input().split()
x = {}
for i in range(N):
  x[i] = int(line[i])

# bad_method(N, A, x)
well_method(N, A, x)

# Optimized solution
def count_up(N, A, x, check, card, total):
  if check == N:
    return 1 if card > 0 and card * A == total else 0
  else:
    return count_up(N, A, x, check+1, card+1, total+x[check]) + count_up(N, A, x, check+1, card, total)

def bad_method(N, A, x):
  print(count_up(N, A, x, 0, 0, 0))

def well_method(N, A, x):
  dp = [[[1 for a in range(N*50)] for b in range(N+1)] for c in range(N+1)]
  for j in range(N+1):
    for k in range(N+1):
      for s in range(N*50):
        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

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

def good_method(N, A, x):
  y = {}
  for i in range(len(x)):
    y[i] = x[i] - A
  dp = [[0 for a in range(N*50*2+1)] for b in range(N+1)]
  for j in range(N+1):
    for t in range(N*50*2+1):
      if j == 0 and t == N*50:
        dp[j][t] = 1
      elif j >= 1 and (t - y[j-1] < 0 or t - y[j-1] > N*50*2):
        dp[j][t] = dp[j-1][t]
      elif j >= 1 and 0 <= t - y[j-1] and t - y[j-1] <= N*50*2:
        dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j-1]]
      else:
        dp[j][t] = 0

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

line = input().split()
N = int(line[0])
A = int(line[1])
line = input().split()
x = {}
for i in range(N):
  x[i] = int(line[i])

# bad_method(N, A, x)
# well_method(N, A, x)
good_method(N, A, x)
# Original solution
n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
max_x = max(x)
dp = [[[0]*(n*max_x+1) for i in range(n+1)] for j 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*max_x+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]]
      else:
        continue
ans = 0
for j in range(1,n+1):
  if j*a <= n*max_x+1:
    ans += dp[n][j][j*a]
print(ans)

# Optimized solution
n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
max_x = max(max(x),a)
dp = [[[0]*(n*max_x+1) for i in range(n+1)] for j 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*max_x+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]]
      else:
        continue
ans = 0
for j in range(1,n+1):
    ans += dp[n][j][j*a]
print(ans)
# Original solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
X=max(max(x),a)

dp=[[[None for i in range(n*X+1)] for h in range(n+1)] for g 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 x[j-1]>s:
                dp[j][k][s]=dp[j-1][k][s]
            elif j>=1 and k>=1 and x[j-1]<=s:
                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()))
X=max(max(x),a)
y=[]
for i in x:
    y.append(i-a)
dp=[[None for i in range(2*n*X+1)] for h 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:
                dp[j][t]=1
            elif j>=1 and (t-y[j-1]<0 or t-y[j-1]>2*n*X):
                dp[j][t]=dp[j-1][t]
            elif j>=1 and t-y[j-1]>=0 and t-y[j-1]<=2*n*X:
                dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j-1]]
            else:
                dp[j][t]=0
                
print((dp[n][n*X]-1))
# Original solution
def resolve():
    N, A = list(map(int, input().split()))
    X = sorted(list(map(int, input().split())))
    cnt = 0
    for bits in range(1, 1<<N):
        flags = list(bin(bits)[2:].zfill(N))
        _X = [x for i, x in enumerate(X) if flags[i]=="1"]
        cnt += 1 if sum(_X)/len(_X) == A else 0
    print(cnt)
    


if '__main__' == __name__:
    resolve()



# Optimized solution
def resolve():
    N, A = list(map(int, input().split()))
    X = [int(i) - A for i in input().split()]
    d = {0: 1}
    for x in X:
        for _sum, count in list(d.items()):
            d[_sum+x] = d.get(_sum+x, 0) + count

    print((d[0]-1))
    


if '__main__' == __name__:
    resolve()
# Original solution
n,a=list(map(int,input().split()))
l=[int(i) for i in input().split()]
ans=0
#dp=[[[0 for i in range(51)] for j in range(51)] for k in range(2501)]
dp=[[[0 for i in range(2501)] for j in range(51)] for k in range(51)]
dp[0][0][0]=1

for i in range(n):
    for j in range(50):
        for k in range(2501):
            if dp[i][j][k]:
                dp[i+1][j][k]+=dp[i][j][k]
                dp[i+1][j+1][k+l[i]]+=dp[i][j][k]
for i in range(1,n+1):
    ans+=dp[n][i][i*a]
print(ans)

# Optimized solution
def sol():
    n,a=list(map(int,input().split()))
    x=[int(i) for i in input().split()]
    ans=chk=0
    d=[[0]*2501 for j in range(51)]
    d[0][0]=1
    for i in x:
        for j in range(2500,i-1,-1):
            for k in range(50,0,-1):
                d[k][j]+=d[k-1][j-i]
    for i in range(1,51):
        ans+=d[i][i*a]
    print(ans)

if __name__=="__main__":
    sol()
# Original solution
def factorial(n):
    k = 1
    for i in range(n): k *= (i + 1)
    return k

def binomial(a, b):
    return factorial(a) // (factorial(a - b) * factorial(b))

cache = {}

def s(x, a, k, i):
    key = (a, k, i)
    if key in cache: return cache[key]
    if a < 0: return 0
    if k < 0: return 0
    if k == 0:
        if a == 0: return 1
        else: return 0
    if i > a: return 0
    if i == 51: return 0
    c = s(x, a, k, i + 1)
    for j in range(1, x[i] + 1):
        c += binomial(x[i], j) * s(x, a - i * j, k - j, i + 1)
    cache[key] = c
    return c

n, a = list(map(int, input().split()))
x = [0] * 51
for k in input().split():
    x[int(k)] += 1

c = 0
for i in range(1, n + 1):
    c += s(x, a * i, i, 0)
print(c)


# Optimized solution
b = []
def binomial(n):
    global b
    b = [None] * n
    for i in range(n):
        b[i] = [0] * n
        b[i][i] = 1
    for i in range(1, n):
        for j in range(1, i + 1):
            b[i][j] = b[i - 1][j - 1] + b[i - 1][j]
    
cache = {}

def s(x, a, k, i):
    key = (a, k, i)
    if key in cache: return cache[key]
    if a < 0: return 0
    if k < 0: return 0
    if k == 0:
        if a == 0: return 1
        else: return 0
    if i > a: return 0
    if i == 51: return 0
    c = s(x, a, k, i + 1)
    for j in range(1, x[i] + 1):
        c += b[x[i] + 1][j + 1] * s(x, a - i * j, k - j, i + 1)
    cache[key] = c
    return c

n, a = list(map(int, input().split()))
binomial(n + 2)
x = [0] * 51
for k in input().split():
    x[int(k)] += 1

c = 0
for i in range(1, n + 1):
    c += s(x, a * i, i, 0)
print(c)
# Original solution
b = []
def binomial(n):
    global b
    b = [None] * n
    for i in range(n):
        b[i] = [0] * n
        b[i][i] = 1
    for i in range(1, n):
        for j in range(1, i + 1):
            b[i][j] = b[i - 1][j - 1] + b[i - 1][j]
    
cache = {}

def s(x, a, k, i):
    if a < 0: return 0
    if k < 0: return 0
    if k == 0:
        if a == 0: return 1
        else: return 0
    if i > a: return 0
    if i == 51: return 0
    key = (a, k, i)
    if key in cache: return cache[key]
    c = s(x, a, k, i + 1)
    for j in range(1, x[i] + 1):
        c += b[x[i] + 1][j + 1] * s(x, a - i * j, k - j, i + 1)
    cache[key] = c
    return c

n, a = list(map(int, input().split()))
binomial(n + 2)
x = [0] * 51
for k in input().split():
    x[int(k)] += 1

c = 0
for i in range(1, n + 1):
    c += s(x, a * i, i, 0)
print(c)


# Optimized solution
n, a = list(map(int, input().split()))
x = [int(i) for i in input().split()]
cache = {}
def s(v, k, i):
    if i == n: return int(v > 0 and v == k * a)
    if v > a * n: return 0
    key = (v, k, i)
    if key in cache: return cache[key]
    cache[key] = s(v, k, i + 1) + s(v + x[i], k + 1, i + 1)
    return cache[key]

print((s(0, 0, 0)))
# Original solution
f=lambda:list(map(int,input().split()))
n,a=f()
l=[i-a for i in f()]
dp=[[0]*5000 for _ in range(51)]
Z=2500
dp[0][Z]=1
for i in range(n):
  for s in range(5000-max(l[i],0)):
    dp[i+1][s]+=dp[i][s]
    dp[i+1][s+l[i]]+=dp[i][s]
print((dp[n][Z]-1))

# Optimized solution
_,a,*l=list(map(int,open(0).read().split()))
d={0:1}
for i in l:
  for k,v in list(d.copy().items()): d[i-a+k]=d.get(i-a+k,0)+v
print((d[0]-1))
# Original solution
n,a,*l=list(map(int,open(0).read().split()))
R=2500
dp=[[0]*R*2,[0]*R*2]
dp[0][0]=1
for i in range(n):
  for s in range(-R,R):
    dp[i+1&1][s]=dp[i&1][s]+dp[i&1][s-l[i]+a]
print((dp[n&1][0]-1))

# Optimized solution
n,a,*l=list(map(int,open(0).read().split()))
R=2500
dp=[[0]*R*2,[0]*R*2]
dp[0][0]=1
t=0
for i in range(n):
  u=1-t
  for s in range(-R,R):
    dp[u][s]=dp[t][s]+dp[t][s-l[i]+a]
  t=u
print((dp[t][0]-1))
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
M = max(x)
M = max(M, a)
dp = [[[0]*(n*M+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*M+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]]
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()))
M = max(x)
M = max(M, a)
dp = [[[0]*(n*M+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for j in range(n):
    for k in range(n+1):
        for s in range(n*M+1):
            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)
# Original solution
import collections

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

sums = collections.Counter([0, X[0]])
# Xから1枚以上選んで作ることが可能な和:作り方の場合の数
# 1枚も選ばない＝0:1通り
# X[0]のみ選ぶ＝X[0]:1通り

for i in X[1:]: # 選べるカードを増やしていく (X[0] ~ X[i] から選ぶ)
    sums2 = collections.Counter()
    for s, c in list(sums.items()):
        sums2[s + i] += c # X[0] ~ X[i - 1] で作れる和に X[i] を足す
    sums += sums2

print((sums[0] - 1)) # 1枚も選ばないのはルール違反

# Optimized solution
import collections

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

S = collections.Counter([0, X[0]])
# Xから1枚以上選んで作ることが可能な和:作り方の場合の数
# 1枚も選ばない＝0:1通り
# X[0]のみ選ぶ＝X[0]:1通り

for i in X[1:]: # 選べるカードを増やしていく (X[0] ~ X[i] から選ぶ)
    S_temp = collections.Counter()
    for s, c in list(S.items()):
        S_temp[s + i] += c # X[0] ~ X[i - 1] で作れる和に X[i] を足す
    S += S_temp

print((S[0] - 1)) # 1枚も選ばないのはルール違反
# Original solution
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""

dp =  [[[0] * (50 * n + 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):
  x = xlst[i]
  for j in range(1, n + 1):
    for k in range(1, n * 50 + 1):
      if k >= x:
        dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
      else:
        dp[i][j][k] += dp[i - 1][j][k]
ans = 0
for j in range(1, n + 1):
  ans += dp[n][j][j * a]

print(ans)

# Optimized solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))
  xlst.insert(0, 0)
  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]
  
  ans = 0
  for j in range(1, n + 1):
    ans += dp[n][j][j * a]
  
  print(ans)

main()
# Original solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))
  xlst.insert(0, 0)
  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]
  
  ans = 0
  for j in range(1, n + 1):
    ans += dp[n][j][j * a]
  
  print(ans)

main()

# Optimized solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))
  #xlst.insert(0, 0)

  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  """
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]

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

  """

  ans = 0
  dp = [[0] * (n * 50 + 1) for _ in range(n + 1)]
  dp[0][0] = 1
  for x in xlst:
    for j in range(n, 0, -1):
      for k in range(n * 50, x - 1, -1):
        dp[j][k] += dp[j - 1][k - x]
  for j in range(1, n + 1):
    ans += dp[j][j * a]
  print(ans)
main()
# Original solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))
  #xlst.insert(0, 0)

  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  """
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]

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

  """

  ans = 0
  dp = [[0] * (n * 50 + 1) for _ in range(n + 1)]
  dp[0][0] = 1
  for x in xlst:
    for j in range(n, 0, -1):
      for k in range(n * 50, x - 1, -1):
        dp[j][k] += dp[j - 1][k - x]
  for j in range(1, n + 1):
    ans += dp[j][j * a]
  print(ans)
main()

# Optimized solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))

  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  """
  xlst.insert(0, 0)
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]

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

  """

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

  for x in xlst:
    for j in range(n, 0, -1):
      dpj = dp[j]
      dpj1 = dp[j - 1]
      for k in range(n * 50, x - 1, -1):
        dpj[k] += dpj1[k - x]

  print((sum([dp[j][j * a] for j in range(1, n + 1)])))
main()
# Original solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))

  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  """
  xlst.insert(0, 0)
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]

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

  """

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

  for x in xlst:
    for j in range(n, 0, -1):
      dpj = dp[j]
      dpj1 = dp[j - 1]
      for k in range(n * 50, x - 1, -1):
        dpj[k] += dpj1[k - x]

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

# Optimized solution
def main():
  n, a = list(map(int, input().split()))
  xlst = list(map(int, input().split()))

  """
  #dp[i][j][k] ... iまででj個使ってkを作る
  #dp[i][j][k] += dp[i - 1][j - 1][k - x]
  
  xlst.insert(0, 0)
  dp =  [[[0] * (50 * n + 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):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]

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

  """

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

  for x in xlst:
    for j in range(n, 0, -1):
      dpj = dp[j]
      dpj1 = dp[j - 1]
      for k in range(x, n * 50 + 1):
        dpj[k] += dpj1[k - x]

  print((sum([dp[j][j * a] for j in range(1, n + 1)])))
main()
# Original solution
n,a=list(map(int,input().split()))
arr=list(map(int,input().split()))
x=max(arr)
x=max(x,a)
dp=[[[0 for i in range(n*x+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):
  xi=arr[i-1]
  for j in range(n+1):
    for k in range(n*x+1):
      if k<xi:
        dp[i][j][k]=dp[i-1][j][k]
      else:
        if j>=1:
          dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-xi]
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()))
arr=list(map(int,input().split()))
l=n*max(a,max(arr))
dp=[[[0]*(l+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  xi=arr[i-1]
  for j in range(0,i+1):
    for k in range(0,l+1):
      if k<xi:
        dp[i][j][k]=dp[i-1][j][k]
      elif j>=1:
        dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-xi]
ans=0
for i in range(1,n+1):
  ans+=dp[n][i][i*a]
print(ans)