Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i.
He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A.
In how many ways can he make his selection?

-----Constraints-----
 - 1 \leq N \leq 50
 - 1 \leq A \leq 50
 - 1 \leq x_i \leq 50
 - N,\,A,\,x_i are integers.

-----Partial Score-----
 - 200 points will be awarded for passing the test set satisfying 1 \leq N \leq 16.

-----Input-----
The input is given from Standard Input in the following format:
N A
x_1 x_2 ... x_N

-----Output-----
Print the number of ways to select cards such that the average of the written integers is exactly A.

-----Sample Input-----
4 8
7 9 8 9

-----Sample Output-----
5

 - The following are the 5 ways to select cards such that the average is 8:
 - Select the 3-rd card.
 - Select the 1-st and 2-nd cards.
 - Select the 1-st and 4-th cards.
 - Select the 1-st, 2-nd and 3-rd cards.
 - Select the 1-st, 3-rd and 4-th cards.

Difficulty: introductory

Starter code:

Solutions:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
n, a = map(int, input().split())            
x = [i - a for i in map(int, input().split())]
dp = [[0 for j in range(4901)] for i in range(n)]
dp[0][2450] += 1
dp[0][x[0] + 2450] += 1
for i in range(1, n):
    for j in range(4901):
        dp[i][j] = dp[i - 1][j]
        if 0 <= j - x[i] < 4901:
            dp[i][j] += dp[i - 1][j - x[i]]
ans = dp[n - 1][2450] - 1
print(ans)

def abc044_c():
    #値入力
    _, A = map(int, input().split())
    X = list(map(lambda x : int(x)-A,input().split()))
    #初期値
    d = {0:1}
    for x in X:
        for k,v in list(d.items()):
            d[k + x] = d.get(k + x,0) + v #差分の合計
    ans = d[0] - 1 #差分合計0で初期値を除く
    print(ans)

def __starting_point():
    abc044_c()
__starting_point()

ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
def ncr(n,r):
    ret = 1
    if n<r:
        return 0
    if n-r <r:
        r = n-r
    for i in range(1,r+1):
        ret*=(n-r+i)
        ret//=i
    return ret

n,a = ma()
X = lma()
for i in range(n):
    X[i] -= a
co = collections.Counter(X)
ans = 0
mx = 49*n #ずれの最大はA=1,x=50 2*mx +1この配列
dp = [[0 for j in range(-mx,mx+1)] for i in range(n+1)]# dp[i][j] iまで使って値をjにする組み合わせ
dp[-1][0] = 1 #一個も使わない組み合わせ
for i in range(n):
    x = X[i]
    #print(x)
    for j in range(-mx,mx+1,1):
        dp[i][j] += dp[i-1][j] + dp[i-1][j-x] #選ばない/ぶ
        #if j==0:print(i,j,dp[i-1][j] , dp[i-1][j-x])
print(dp[n-1][0]-1)


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)


n,a,*l=map(int,open(0).read().split())
R=2500
dp=[[0]*R*2 for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
  for s in range(-R,R):
    dp[i+1][s]=dp[i][s]+dp[i][s-l[i]+a]
print(dp[n][0]-1)

n, a = map(int, input().split())
x = list(map(int, input().split()))
x = [i - a for i in x]
dic = {0:1}
for i in x:
    for j, k in list(dic.items()):
        dic[i+j] = dic.get(i+j, 0) + k

print(dic[0] - 1)

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, *X = list(map(int, read().split()))

    X = [x - A for x in X]

    base = 2500
    dp = [0] * 5001
    dp[base] = 1
    for i in range(N):
        dp, dp_prev = dp[:], dp
        for j in range(5001):
            if 0 <= j - X[i] <= 5000:
                dp[j] += dp_prev[j - X[i]]

    print((dp[base] - 1))

    return


def __starting_point():
    main()

__starting_point()

from collections import defaultdict
import io

nim, mike = map(int, input().split())
kite = list(map(int, input().split()))
for i in range(nim):
    kite[i] -= mike
qwe = defaultdict(int)
qwe[0] = 1
for o in kite:
    for j, c in list(qwe.items()):
        qwe[j + o] += c
print(qwe[0]-1)

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))
 
    dp = [[0] * (A * N + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i, x in enumerate(X):
        for j in reversed(list(range(1, i + 2))):
            for a in range(x, A * N + 1):
                dp[j][a] += dp[j - 1][a - x]
    print((sum(dp[i][A * i] for i in range(1, N + 1))))
 
solve()


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

dp = {0: 1}

for i in x:
    tmp = list(dp.items())
    for key, value in tmp:
        dp[key+i] = dp.get(key+i, 0) + value
print((dp[0] - 1))




def abc044_c():
    ''' 過去提出を参考に '''
    _, A = map(int, input().split())
    X = list(map(lambda x: int(x) - A, input().split()))
    d = {0: 1}  # 負の値を取り得るため、配列でなく辞書で持つ
    for x in X:
        prev = list(d.items())  # 前のターンのぶんを保持しておく
        for val, cnt in prev:
            d[val + x] = d.get(val + x, 0) + cnt
    ans = d[0] - 1
    print(ans)

def __starting_point():
    abc044_c()
__starting_point()

n, a = list(map(int, input().split()))
xxx = list(map(int, input().split()))
limit = a * n
dp = [[0] * (limit + 1) for i in range(n + 1)]
dp[0][0] = 1
for i, x in enumerate(xxx):
    if x > limit:
        continue
    for j in range(i, -1, -1):
        for k in range(limit - x, -1, -1):
            dp[j + 1][k + x] += dp[j][k]

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


#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


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

def main():
  n,a = readInts()
  
  X = readInts()
  
  X = list(map(lambda i: i-a, X))# lambda iに、 i - aという演算のもと Xから入れる
  # ここで、平均が8になるもの key = 0の時が答えになる。
  # だからこそ　答えで dp[0] - 1 するのはこのため
  
  dp = {0:1} 
  
  for i in X:
    for k,v in list(dp.items()): # key,valueをそれぞれ抽出
      dp[i+k] = dp.get(i+k, 0) + v
      #
      # get(なんか) なんかに入ってる辞書のvalueが返ってくる
      # 無かったら、get(なんか,〇)で、〇に入ってるので辞書が更新される
      # 
  # print(dp)
  #{0: 6, 1: 6, 2: 2, -1: 2}
  # 負の数にも対応している
  print(dp[0]-1)
  
def __starting_point():
  main()
__starting_point()

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

dp = defaultdict(dict)
dp[0][0] = 1  # カード0枚で合計

for x in X:
    newDP = defaultdict(dict)
    for card, memo in dp.items():
        for k, v in memo.items():
            # カードXを追加しない
            if k in newDP[card]:
                newDP[card][k] += v
            else:
                newDP[card][k] = v
            # カードXを追加するよ
            if k + x in newDP[card + 1]:
                newDP[card + 1][k + x] += v
            else:
                newDP[card + 1][k + x] = v
    dp = newDP

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


NMAX = 55

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

dp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]

dp[0][0][0] = 1 # dp[i][s][k]: i個からk個選ぶとき、総和がsのものの個数
for i in range(N): # N-1時点でNが更新されるのでここまでで十分
    for s in range(N*A+1):
        for k in range(N+1):
            if dp[i][s][k] == 0:
                continue
            dp[i+1][s][k] += dp[i][s][k]
            dp[i+1][s+X[i]][k+1] += dp[i][s][k]

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

print(ans)


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter, defaultdict


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

    result = Counter([0])

    for x in X:
        dct = defaultdict(int)
        for k, v in list(result.items()):
            dct[k + x] += v
        result += dct

    print((result[0] - 1))


def __starting_point():
    main()

__starting_point()

N,A = (int(T) for T in input().split())
X = [int(T) for T in input().split()]
DP = [[[0]*(N+1) for TS in range(0,50*N+1)] for TI in range(0,N+1)]
DP[0][0][0] = 1
for TI in range(0,N):
    for TS in range(0,50*N+1):
        for TK in range(0,N+1):
            if DP[TI][TS][TK]!=0:
                DP[TI+1][TS][TK] += DP[TI][TS][TK]
                DP[TI+1][TS+X[TI]][TK+1] += DP[TI][TS][TK]
print(sum(DP[N][A*TA][TA] for TA in range(1,N+1)))

n, a = map(int, input().split())
x = list(map(int, input().split()))
for i in range(n):
    x[i] -= a
dp = [[0 for i in range(100 * n + 1)] for j in range(n + 1)]
dp[0][50 * n] = 1
for i in range(n):
    for j in range(100 * n + 1):
        j2 = j - 50 * n
        num = x[i]
        if -50 * n <= j2 - num <= 50 * n:
            dp[i + 1][j] = dp[i][j] + dp[i][j - num]
        else:
            dp[i + 1][j] = dp[i][j]
print(dp[n][50 * n] - 1)

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

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

print(dp[0]-1)

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

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

maxint = 50 * N

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

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

for xi, xe in enumerate(x, 1):
    for j in range(xi+1):
        for k in range(maxint + 1):
            dp[xi][j][k] = dp[xi - 1][j][k]
            
            if j >= 0 and k >= xe:
                dp[xi][j][k] += dp[xi - 1][j - 1][k - xe]
                

res = 0

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

print(res)

N,A = list(map(int,input().split()))
X = list(map(int,input().split()))
dp = [[[0 for _ in range(50*(N+2))] for _ in range(N+2)] for _ in range(N+2)]

dp[0][0][0] = 1
#kまでみた
for k in range(N):
    #used個使った
    for used in range(N):
        for i in range(50*N):
            #使う時
            if dp[used][k][i] == 0: 
                continue
            dp[used+1][k+1][i+X[k]] += dp[used][k][i]
            dp[used][k+1][i] += dp[used][k][i]
ans = 0
for used in range(1,N+1):
    ans += dp[used][N][used*A]
print(ans)




n,a=map(int,input().split())
nums=[int(i)-a for i in input().split()]
d={0:1}
for i in nums:
  s = [[j, d[j]] for j in d]
  for j in s:
    if j[0] + i in d:
      d[j[0]+i] += j[1]
    else:
      d[j[0]+i] = j[1]
print(d[0]-1)

n,a,*l=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)

def c_tak_and_cards():
    from collections import defaultdict
    N, A = [int(i) for i in input().split()]
    X = [int(i) for i in input().split()]

    average = [x - A for x in X]
    dp = defaultdict(int)  # dp[s]: y から 1 枚以上選んで整数の和を s にする方法
    dp[0] = 1  # 「選ばない」 1 通り
    for y in average:
        for k, v in list(dp.items()):  # for 文中で要素数が変わってはいけないため
            dp[k + y] += v
    return dp[0] - 1

print(c_tak_and_cards())

import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

dp[0][0] = 1

for i in range(0, N):
    for cnt in range(N, 0, -1):
        for val in range(N * A, -1, -1):
            if val - X[i] >= 0:
                dp[cnt][val] += dp[cnt - 1][val - X[i]]

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

print(ans)

import numpy as np

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

dp = np.zeros((n + 1, MAX + 1), np.int64)
dp[0][0] = 1

for e in x:
    dp[1:, e:] += dp[:-1, :-e]

cnt = np.arange(1, n + 1)
sm = cnt * a
ans = dp[cnt, sm].sum()

print(ans)


def abc044_c():
    N, A = map(int, input().split())
    X = list(map(lambda x: int(x) - A, input().split()))  # 平均ターゲットを引いた状態
    dp = [dict() for _ in range(N+1)]  # 負の値を取り得るため、配列でなく辞書で持つ
    dp[0][0] = 1  # 0枚時点で何も選ばない、を初期値とする
    for i, x in enumerate(X):
        dp[i+1] = dp[i].copy()  # 前の状態を引き継ぐ
        for val, cnt in dp[i].items():
            dp[i+1][val + x] = dp[i].get(val + x, 0) + cnt  # 前のターンのxシフト分を加算
    ans = dp[N][0] - 1
    print(ans)

def __starting_point():
    abc044_c()
__starting_point()

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



n,a,=map(int,input().split())
x=list(map(lambda y:int(y)-a,input().split()))
w=2*n*(max(max(x),a))
dp=[[0]*(w+1) for _ in range(n+1)]
dp[0][w//2]=1
for i in range(1,n+1):
  for j in range(w+1):
    dp[i][j]=dp[i-1][j]+(dp[i-1][j-x[i-1]] if 0<=j-x[i-1]<=w else 0)
print(dp[n][w//2]-1)

import numpy as np
n,a = map(int,input().split())
x = list(map(int,input().split()))
"""
平均がa <=> 集合をlとして, len(l)a = sum(l)
dp[i][j][k] := i番目までのカードを選んだとき, 選んだ枚数がkでの総和がちょうどjになる場合の数.
これだとメモリが足りないので, iを省略する.
"""
sumx = sum(x)
dp = np.zeros((n, sumx+1), dtype=np.int64)
for i in range(n):
	for j in range(i)[::-1]:
		dp[j+1][x[i]:] += dp[j][:-x[i]]
	dp[0][x[i]] += 1
ans = 0
for i in range(n):
	if (i+1)*a <= sumx:
		ans += dp[i][(i+1)*a]
print(ans)

import numpy as np
n,a=map(int,input().split())
x=list(map(int,input().split()))
s=sum(x)
dp=np.zeros((n,s+1),dtype=np.int64)
for i in range(n):
    for j in range(i)[::-1]:
        dp[j+1][x[i]:]+=dp[j][:-x[i]]
    dp[0][x[i]]+=1
t=0
for k in range(n):
    if (k+1)*a<=s:
        t+=dp[k][(k+1)*a]
print(t)

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

dp=[[[0]*(2550) for _ in range(55)] for _ in range(55)]
dp[0][0][0]=1
for i in range(n):
    for j in range(n+1):
        for sm in range(n*a+1):
            if dp[i][j][sm]==0:
                continue
            dp[i+1][j][sm]+=dp[i][j][sm]
            dp[i+1][j+1][sm+x[i]]+=dp[i][j][sm]

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


N,A=map(int,input().split())
x=list(map(int,input().split()))
x=[i-A for i in x]
dp=[[0]*50*N*2 for i in range(N+1)]
dp[0][50*N]=1
for i in range(1,N+1):
    for j in range(50*N*2):
        n=j-x[i-1]
        if n>=0 and n<50*N*2:
            dp[i][j]=dp[i-1][j]+dp[i-1][n]
        else:
            dp[i][j]=dp[i-1][j]
    #else:
        #print(dp[i])

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

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

blist = list(map(lambda x:x-A,alist))
sum_plus = 0
sum_minus = 0
for i in blist:
    if i >0:
        sum_plus +=i
    else:
        sum_minus +=i

N=len(alist)
dp = [[0 for i in range(sum_plus - sum_minus + 1)] for j in range(N+1)]
dp[0][0-sum_minus]=1

for i in range(N):
    for j in range(sum_plus - sum_minus+1):
        if j-blist[i] <= (sum_plus - sum_minus):
            dp[i+1][j]=dp[i][j-blist[i]]+dp[i][j]
        else:
            dp[i+1][j]=dp[i][j]

print(dp[N][0-sum_minus]-1)

import sys
readline = sys.stdin.readline

def main():
    N, A = map(int, readline().rstrip().split())
    X = list(map(int, readline().rstrip().split()))
    lim = max(X) * N
    X = [x-A for x in X]
    dp = [[0]*(2*lim) for _ in range(N+1)]
    dp[0][lim] = 1
    for i in range(1, N+1):
        x = X[i-1]
        for j in range(2*lim):
            if 0 <= j - x < 2 * lim:
                dp[i][j] = dp[i-1][j] + dp[i-1][j-x]
            else:
                dp[i][j] = dp[i-1][j]
    
    print(dp[N][lim] - 1)


def __starting_point():
    main()
__starting_point()

import collections
N, A = [int(_) for _ in input().split()]
X = [int(_) for _ in input().split()]


def calc(W):
    #dp[m][s]=m枚のカードの和がsとなるような選び方の総数
    M = len(W)
    dp = [collections.defaultdict(int) for _ in range(M + 1)]
    dp[0][0] = 1
    for i, w in enumerate(W):
        for j in range(i, -1, -1):
            for k, v in list(dp[j].items()):
                dp[j + 1][k + w] += v
    return dp


dpx = calc(X)
print((sum(dpx[i][i * A] for i in range(1, N + 1))))


import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    dp = np.zeros((n + 1, 2501), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        dp[1:, x[i]:] += dp[:-1, :-x[i]].copy()
    i = np.arange(1, n + 1)
    print(dp[i, i * a].sum())

if __name__ ==  '__main__':
    main()

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

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

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


#!/usr/bin python3
# -*- coding: utf-8 -*-

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

    ret={0: 1}
    for xi in X:
        for y, cnt in list(ret.items()):
            ret[xi+y] = ret.get(xi+y, 0) + cnt
    print(ret[0]-1)

def __starting_point():
    main()
__starting_point()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, *X = list(map(int, read().split()))

    X = [x - A for x in X]

    base = 2500
    dp = [[0] * 5001 for _ in range(N + 1)]
    dp[0][base] = 1
    for i in range(N):
        for j in range(-2500, 2501):
            if -2500 <= j - X[i] <= 2500:
                dp[i + 1][j + base] = dp[i][j + base] + dp[i][j - X[i] + base]
            else:
                dp[i + 1][j + base] = dp[i][j + base]

    print((dp[N][base] - 1))

    return


def __starting_point():
    main()

__starting_point()

N,A = map(int,input().split())
ls1 = [0] + list(map(int,input().split()))

dp = [[[0 for k in range(2600)] for j in range(51) ] for i in range(51)]
for i in range(51):
    dp[i][0][0] = 1
for j in range(1,N+1):
    for k in range(1,j+1):
        for s in range(2600):
            if s < ls1[j]:
                dp[j][k][s] = dp[j-1][k][s]
            elif s >= ls1[j]:
                dp[j][k][s] = dp[j-1][k-1][s-ls1[j]] + dp[j-1][k][s]
ans = 0
for k in range(1,N+1):
    ans += dp[N][k][k*A]
print(ans)

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

x=[i-a for i in x]
dp=[[0]*n*50*2 for i in range(n+1)]

dp[0][n*50]=1

for i in range(n):
    for j in range(n*50*2):
        t=j-x[i]
        if 0<=t<n*50*2:
            dp[i+1][j]=dp[i][j]+dp[i][t]
        else:
            dp[i+1][j]=dp[i][j]
print((dp[n][n*50]-1))


def abc044_c():
    import numpy as np
    n, a = map(int, input().split())
    x = list(map(lambda x: int(x) - a, input().split()))  # 平均ターゲット値を引いておく
    x = np.array(x, dtype=np.int64)

    vrange = n * (a + np.max(x))  # 取りうる値の幅(片側), 広めにとってもかまわない
    dp = np.zeros((n+1, 2*vrange+1), dtype=np.int64)  # DPテーブル
    dp[0, vrange] = 1  # 0枚時点で何も選ばずに総和0(平均ターゲット)になる場合を初期値にセット

    for i in np.arange(n):
        # 1つ前のターンを引き継ぐ
        dp[i+1, :] += dp[i, :]
        if 0 < x[i]:
            # x[i]が正の値、1つ前のx[i]個ぶん左側をスライドして持ってくる
            dp[i+1, x[i]:] += dp[i, :-x[i]]
        elif x[i] < 0:
            # x[i]が負の値、1つ前のx[i]個ぶん右側をスライドして持ってくる
            dp[i+1, :x[i]] += dp[i, -x[i]:]
        else:
            # x[i]がゼロ
            dp[i+1, :] += dp[i, :]

    ans = dp[n, vrange] - 1  # 初期値(何も選ばない)の1通りを除く
    print(ans)

def __starting_point():
    abc044_c()
__starting_point()

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

dp = [[0]*(N*A+1) for _ in range(N+1)] #dp[i][j]:i枚の和がjとなるようなカードの選び方
dp[0][0] = 1  
for x in X:
    for i in reversed(range(1,N+1)):
        for j in reversed(range(N*A+1)):
            if j < x:
                continue
            dp[i][j] += dp[i-1][j-x]
ans = sum(dp[k][k*A] for k in range(1,N+1)) 
print(ans) 

N,A = list(map(int,input().split()))
ls1 = [0] + list(map(int,input().split()))

dp = [[[0 for k in range(2600)] for j in range(51) ] for i in range(51)]
for i in range(51):
    dp[i][0][0] = 1
for j in range(1,N+1):
    for k in range(1,j+1):
        for s in range(2600):
            if s < ls1[j]:
                dp[j][k][s] = dp[j-1][k][s]
            elif s >= ls1[j]:
                dp[j][k][s] = dp[j-1][k-1][s-ls1[j]] + dp[j-1][k][s]
ans = 0
for k in range(1,N+1):
    ans += dp[N][k][k*A]
print(ans)


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

for i in range(n):
  x[i] -= a

d = [0] * 6000
ans = 0
for dif in x:
  ans += d[-dif+3000]
  if dif == 0:
    ans += 1
  if dif < 0:
    for i in range(6000):
      if 0 <= i+dif < 6000:
        d[i+dif] += d[i]
  else:
    for i in range(5999, -1, -1):
      if 0 <= i+dif < 6000:
        d[i+dif] += d[i]
  d[dif+3000] = d[dif+3000] + 1
  
print(ans)

n,a=map(int,input().split())
from collections import Counter
X = [int(x) - a for x in input().split()]
d=Counter([0])
for i in X:
    tmp=Counter()
    for j,k in d.items():
        tmp[i+j]+=k
    d+=tmp
print(d[0]-1)

#想定解法
N, A = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
xm = max(X)
xm = max(xm, A)
for i in range(N):
  X[i] -= A 
#print(X, xm)
dp = [[0] * (2 * N * xm + 1) for i in range(N + 1)]
dp[0][N * xm] = 1

for i in range(1, N + 1):
  for j in range(2 * N * xm + 1):
    if 0 <= j - X[i - 1] <= 2 * N * xm:
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - X[i - 1]]
    else:
      dp[i][j] = dp[i - 1][j]

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


import numpy as np
n, a = map(int, input().split())
x = list(map(int, input().split()))

s = sum(x)
dp = np.zeros((n, s+1), dtype = np.int64)
for i in range(n):
  for j in range(i)[::-1]:
    dp[j+1][x[i]:] += dp[j][:-x[i]]
  dp[0][x[i]] += 1
ans = 0
for i in range(n):
  if (i+1)*a <= s:
    ans += dp[i][(i+1)*a]
print(ans)

f=lambda: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)

n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[0]*2501 for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
    x=X[i]
    for j in range(n,0,-1):
    	for k in range(2501-x):
        	dp[j][k+x]+=dp[j-1][k]
ans=0
for i in range(n):
    ans+=dp[i+1][(i+1)*a]
print(ans)

N, A = map(int, input().split())
X = list(map(int, input().split()))
dp = [[[0] * 6000 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(5000):
            if dp[i][j][k] == 0:
                continue
            dp[i + 1][j][k] += dp[i][j][k]
            dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
C = 0
for i in range(N + 1):
    C += dp[N][i][i * A]
print(C - 1)

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, *X = list(map(int, read().split()))

    X = [x - A for x in X]

    neg = pos = 0
    for x in X:
        if x > 0:
            pos += x
        else:
            neg += x

    M = pos - neg
    base = -neg

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

    for i in range(N):
        for s in range(M + 1):
            dp[i + 1][s] = dp[i][s]
            if 0 <= s - X[i] <= M:
                dp[i + 1][s] += dp[i][s - X[i]]

    print((dp[N][base] - 1))
    return


def __starting_point():
    main()

__starting_point()

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

dp = [[[0 for _ in range(sumX)] 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):
        for s in range(sumX):
            if dp[j][k][s]==0:
                continue
            dp[j+1][k][s] += dp[j][k][s]
            dp[j+1][k+1][s+X[j]] += dp[j][k][s]
ans = 0

for i in range(N+1):
    ans += dp[N][i][i*A]
print(ans-1)


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

dp = [[0]*5001 for i in range(NMAX)]  # i時点で総和がSになるものの個数

dp[0][T] = 1

for i in range(N):
    for s in range(5001):
        if s+X[i] > 5001 or dp[i][s] == 0:
            continue
        dp[i+1][s] += dp[i][s]
        dp[i+1][s+X[i]] += dp[i][s]

print((dp[N][T]-1))



n,a=map(int,input().split())
A=list(map(int,input().split()))
for i in range(n):
  A[i]=A[i]-a
B=[]
c=0
for i in range(n):
  if A[i]==0:
    c=c+1
  else:
    B.append(A[i])
n=len(B)
dp=[[0]*5010 for i in range(n+1)]#0と2505を対応
for i in range(1,n+1):
  dp[i]=dp[i-1][0:5010]
  dp[i][2505+B[i-1]]+=1
  for j in range(5010):
    if 0<=j+B[i-1] and j+B[i-1]<=5009:
      dp[i][j+B[i-1]]+=dp[i-1][j]
ans=dp[n][2505]
print((ans+1)*2**c-1)


NMAX = 55

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

dp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]

dp[0][0][0] = 1 # dp[i][s][k]: i個からk個選ぶとき、総和がsのものの個数
for i in range(N): # N-1時点でNが更新されるのでここまでで十分
    for s in range(3000):
        for k in range(N+1):
            if dp[i][s][k] == 0:
                continue
            dp[i+1][s][k] += dp[i][s][k]
            dp[i+1][s+X[i]][k+1] += dp[i][s][k]

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

print(ans)


import numpy as np
n, a = map(int, input().split())
x = list(map(int, input().split()))

# dp[i][j][k]：　i枚目までのカードをj枚使用して合計kを作れる組み合わせ
dp = np.zeros((n+1, n+1, 3001)).astype(np.int64)
dp[0][0][0] = 1

for i in range(n):
    _x = x[i]
    for j in range(n):
        dp[i+1, j+1, _x:] += dp[i, j, :-_x]
        dp[i+1, j, :] += dp[i, j, :]

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

n,a = map(int,input().split())
x = list(map(int,input().split()))
t = [[[0] * (50*(j+1)+1) for j in range(i+2)] for i in range(n+1)]
ans = 0
t[0][0][0] = 1

for i in range(1, n+1):
    for j in range(i+1):
        for k in range(50*j + 1):
            if j >= 1 and k >= x[i-1]:
                t[i][j][k] = t[i - 1][j - 1][k - x[i-1]] + t[i - 1][j][k]
            else:
                t[i][j][k] = t[i - 1][j][k]
for i in range(1,n+1):
    ans += t[n][i][i*a]
print(ans)

#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return list(map(int, input().split()))
    def mi_0():  return [int(x)-1 for x in input().split()]
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list([int(x)-1 for x in input().split()])
    def li():    return list(input())
    
    
    n, a = mi()
    L = lmi()
    diff = [elm - a for elm in L]
    # dp[i][num] = (diff から i 番目までを使用して和を num - 2500 にする場合の数)
    dp = [[0] * 5001 for _ in range(n + 1)]
    dp[0][2500] = 1

    for i in range(n):
        for j in range(5001):
            if dp[i][j]:
                dp[i+1][j + diff[i]] += dp[i][j]
            dp[i+1][j] += dp[i][j]
    

    print((dp[n][2500] - 1))    # n 番目までを使用して和を 0 にするには？ 最初の何も選ばない 1 通りを除く


def __starting_point():
    main()

__starting_point()

import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    m = 2500
    dp = np.zeros((n + 1, m + 1), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        ndp = np.copy(dp)
        ndp[1:, x[i]:] += dp[:-1, :m-x[i]+1]
        dp = ndp
    i = np.arange(1, n + 1)
    print(np.sum(dp[i, i * a]))

if __name__ ==  '__main__':
    main()

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

    dp = [[0] * (A * N + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i, x in enumerate(X):
        for j in reversed(list(range(1, i + 2))):
            for a in range(x, A * N + 1):
                dp[j][a] += dp[j - 1][a - x]
    return sum(dp[i][A * i] for i in range(1, N + 1))

print((main()))


import sys
from collections import defaultdict

n, a, *x = map(int, sys.stdin.read().split())
for i in range(n): x[i] -= a

def main():
  dp = defaultdict(int); dp[0] = 1
  for i in range(n):
    ndp = dp.copy()
    for k, v in dp.items():
      ndp[k+x[i]] += v
    dp = ndp
  print(dp[0] - 1)
  
def __starting_point():
  main()
__starting_point()

N,A = 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)

n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
import numpy as np
dp=np.zeros((n+1,2501),int)
dp[0,0]=1
for xi in x:
  for i in range(n-1,-1,-1):
    dp[i+1][xi:]+=dp[i,:-xi]
ans=0
for i in range(1,n+1):
  ans+=dp[i,i*a]
print(ans)


import numpy as np
n,avea=tuple([int(x) for x in input().split()])
x=list([int(x) for x in input().split()])
x=np.array(x)
x=x-avea
w=max(abs(min(x)),abs(max(x)))*n
dp=np.zeros((n+1,2*w+1),dtype=int)
dp[0,w]=1
for i in range(1,n+1):
    for j in range(2*w+1):
        if 0<=j-x[i-1]<=2*w:
            dp[i,j]=dp[i-1,j]+dp[i-1,j-x[i-1]]
        else:
            dp[i,j]=dp[i-1,j]
print((dp[n,w]-1))


N, A = map(int, input().split())
x = list(map(int, input().split()))
maxX = max(max(x), A)
dp = [[[0 for _ in range(N * maxX + 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 + 1):
        for k in range(N * A + 1):
            if dp[i][j][k] == 0: continue
            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][A * i]
print(ans)

n, a = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
dp = list([0]*(n*a+1) for _ in range(n+1))#動的計画法で解く
dp[0][0] = 1
for x in l:
    for i in range(n, 0, -1):#下行から順に格納していく(上からだと格納したばかりの値が参照されてしまう)
        for j in range(n*a+1):
            if x > j:
                continue
            dp[i][j] += dp[i-1][j-x]

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

print(ans)

import numpy as np
n,avea=tuple([int(x) for x in input().split()])
x=list([int(x) for x in input().split()])
x=np.array(x)
x=x-avea
w=max(abs(min(x)),abs(max(x)))*n
dp=np.zeros((n+1,2*w+1),dtype=int)
dp[0,w]=1
for i in range(n):
    for j in range(2*w+1):
        if 0<=j-x[i]<=2*w:
            dp[i+1,j]=dp[i,j]+dp[i,j-x[i]]
        else:
            dp[i+1,j]=dp[i,j]
print((dp[n,w]-1))


from collections import Counter


N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = [x - A for x in X]
L = Counter()
L[0] = 1

for y in Y:
    for key, value in list(L.items()):
        L[key + y] += value

print((L[0] - 1))


n,a,*l=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)

n,a=map(int,input().split())
x=list(map(int,input().split()))
dp=[[0]*(n*a+1) for i in range(n+1)]
dp[0][0]=1
ans=0
for i in x:
    for j in range(n,0,-1):
        for k in range(n*a,i-1,-1):
            dp[j][k]+=dp[j-1][k-i]
for i in range(1,n+1):
    ans+=dp[i][i*a]
print(ans)

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



n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
for i in range(n):
    x[i]-=a
# dp[i][j] = i番目までで(j-2500)を何個作れるか
dp=[[0]*5001 for i in range(n+1)]
dp[0][2500]=1
for i in range(n):
    for j in range(5000):
        for k in range(2):
            if 0<=j-k*x[i]<=5000:
                dp[i+1][j]+=dp[i][j-k*x[i]]
print((dp[n][2500]-1))


n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
for i in range(n):
    x[i]-=a
# dp[i][j] = i番目までで(j-2500)を何個作れるか
dp=[[0]*5001 for i in range(n)]
dp[0][x[0]+2500]=1
for i in range(1,n):
    dp[i][x[i]+2500]=1
    for j in range(5000):
        for k in range(2):
            if 0<=j-k*x[i]<=5000:
                dp[i][j]+=dp[i-1][j-k*x[i]]
print((dp[n-1][2500]))


def main():
    N, A = list(map(int, input().split()))
    x = list(map(int, input().split()))
    dp = [[0] * (50*N + 1) for _ in range(N+1)]
    dp[0][0] = 1
    for k in range(N):
        for i in reversed(list(range(k+1))):
            for j in range(50 * N + 1 -x[k]):
                dp[i+1][j+x[k]] += dp[i][j]
    r = 0
    for i in range(1, N+1):
        r += dp[i][i*A]
    return r
print((main()))


N, A = map(int, input().split())
x = list(map(int, input().split()))
maxX = max(max(x), A)
dp = [[[0 for _ in range(N * maxX + 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 + 1):
        for k in range(N * A + 1):
            if dp[i][j][k] == 0: continue
            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][A * i]
print(ans)

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

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

big = []
small = []
cnt = 0

for y in x:
	if y == A:
		cnt += 1
	elif y < A:
		small.append(A-y)
	else:
		big.append(y-A)

big_possible = [0]*2501
small_possible = [0]*2501
big_possible[0] = 1
small_possible[0] = 1

for a in big:
	for i in range(2500-a, -1, -1):
		if big_possible[i]:
			big_possible[i+a] += big_possible[i]

for b in small:
	for i in range(2500-b, -1, -1):
		if small_possible[i]:
			small_possible[i+b] += small_possible[i]

ans = 1
for i in range(1, 2501):
	ans += small_possible[i]*big_possible[i]


ans *= 2**cnt
print((ans-1))


n,a = map(int, input().split())
X = list(map(int, input().split()))
x = [i-a for i in X]
dp = [[0]*5201 for i in range(n+1)]
dp[0][2600] = 1 
for i,xi in enumerate(x):
  for k in range(99,5101):
    dp[i+1][k+xi] += dp[i][k] 
    dp[i+1][k] += dp[i][k]
ans = dp[n][2600] - 1
print(ans)

N,A = map(int,input().split())
Y = list(map(lambda x:int(x)-A,input().split()))
dp = {0:1}

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

print(dp[0]-1)

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

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

print((dp[0]-1))


n, a = map(int, input().split())
xlst = list(map(int, input().split()))
dp = [[0 for _ in range(5001)] for _ in range(n + 1)]
center = 2500
dp[0][center] = 1
for i, x in enumerate(xlst, 1):
    num = x - a
    for j in range(5001):
        dp[i][j] = dp[i - 1][j]
        if 0 <= j - num <= 5000:
            dp[i][j] += dp[i - 1][j - num]
print(dp[-1][center] - 1)

from collections import defaultdict
n, a = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
x = list(map(lambda x:x - a, x))
dic = defaultdict(int)
dic[0] = 1
for i in x:
    for j, k in list(dic.items()):
        dic[j + i] = dic.get(j + i, 0) + k
print(dic[0] - 1)

from collections import defaultdict

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

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

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

print(d[0]-1)

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

dp = [[0]*2501 for _ in range(n+1)]
for i in range(n+1):
  for j in range(i-1, -1, -1):
    if j == 0:
      dp[j+1][x[i-1]] += 1
    for k in range(2500, -1, -1):
      if dp[j][k] and k+x[i-1] <= 2500:
        dp[j+1][k+x[i-1]] += dp[j][k]

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

import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    m = 2500
    dp = np.zeros((n + 1, m + 1), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        ndp = np.copy(dp)
        for j in range(1, n + 1):
            ndp[j][x[i]:] += dp[j-1][:m-x[i]+1]
        dp = ndp
    i = np.arange(1, n + 1)
    print(np.sum(dp[i, i * a]))

if __name__ ==  '__main__':
    main()

_,a,*l=map(int,open(0).read().split())
d={0:1}
for i in l:
  for k,v in d.copy().items(): d[i-a+k]=d.get(i-a+k,0)+v
print(d[0]-1)

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

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

for i, e in enumerate(x, 1):
    for j in range(i):
        for k in range(MAX + 1):
            dp[i][j][k] += dp[i-1][j][k]

    for j in range(i):
        for k in range(MAX - e + 1):
            dp[i][j+1][k+e] += dp[i-1][j][k]

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

print(ans)


N,A = (int(T) for T in input().split())
X = [int(T)-A for T in input().split()]
DP = [[0]*(2*(50*N)+1) for TI in range(0,N+1)]
DP[0][50*N] = 1
for TI in range(0,N):
    for TS in range(0,2*50*N+1):
        if DP[TI][TS]!=0:
            DP[TI+1][TS] += DP[TI][TS]
            DP[TI+1][TS+X[TI]] += DP[TI][TS]
print(DP[N][50*N]-1)

import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    m = 2500
    dp = np.zeros((n + 1, m + 1), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        dp[1:, x[i]:] += dp[:-1, :-x[i]].copy()
    i = np.arange(1, n + 1)
    print(dp[i, i * a].sum())

if __name__ ==  '__main__':
    main()

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


N, A = list(map(int, input().split()))
lst = [int(x) - A for x in input().split()]
dp = [[0] * (100 * N + 1) for _ 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 - lst[i]]
print((dp[N][50 * N] - 1))


N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0]*(2501) for i in range(N+1)] for k in range(N+1)]
dp[0][0][0]=1
for j in range(N):
  for k in range(N):
    for i in range(2501):
      if dp[j][k][i]==0:
        continue
      dp[j+1][k][i]+=dp[j][k][i]
      dp[j+1][k+1][i+x[j]]+=dp[j][k][i]
ans=0
for j in range(N+1):
    ans+=dp[N][j][j*A]
print(ans-1)