CodeEff/ECCO huggingface dataset:
# Original solution
def main():
    N,A = list(map(int,input().split()))
    X = [int(x) for x in input().split()]
    dp = [[[0 for _ in range(2501)] for _ in range(N+1)] for _ in range(N+1)]
    dp[0][0][0] = 1
    for j in range(N):
        now = X[j]
        for k in range(N+1):
            for s in range(2501):
                if now>s:
                    dp[j+1][k][s] = dp[j][k][s]
                else:
                    dp[j+1][k][s] = dp[j][k][s] + dp[j][k-1][s-now]
    ans = 0

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

            

if __name__=="__main__":
    main()

# Optimized solution
def main():
    n,a = list(map(int,input().split()))
    x = [int(x) for x in input().split()]
    dp= [[[0 for _ in range(2501)] for _ in range(n+1)] for _ in range(n)]

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

    for i in range(1,n):
        for j in range(n+1):
            for k in range(2501):
                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 i in range(1,n+1):
        ans += dp[-1][i][a*i]
    print(ans)
    
if __name__ == "__main__":
    main()
# Original solution
from functools import lru_cache

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

# 平均を出すのに選んだ個数が必要
@lru_cache(maxsize=None)
def rec(x, a, k):
    """
    :param x: tuple
        数列
    :param a: int
        総和
    :param k: int
        選ぶ個数
    :return: int
        通り数
        Number of patterns
    """
    if k == 0:
        if a == 0:
            return 1
        else:
            return 0

    if a < 0 or len(x) < k:
        return 0

    ret = rec(x[1:], a, k)
    ret += rec(x[1:], a - x[0], k - 1)
    return ret
X = tuple(sorted(X))
m = (rec(X, k * A, k) for k in range(1, N + 1))
print((sum(m)))

# Optimized solution
from functools import lru_cache

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

# 平均を出すのに選んだ個数が必要
@lru_cache(maxsize=None)
def rec(i, a, k):
    """
    :param i: int 
        数列の長さ
    :param a: int
        総和
    :param k: int
        選ぶ個数
    :return: int
        通り数
        Number of patterns
    """
    if k == 0:
        if a == 0:
            return 1
        else:
            return 0

    if a < 0 or i < k:
        return 0

    ret = rec(i - 1, a, k)
    ret += rec(i - 1, a - X[i - 1], k - 1)
    return ret

i = len(X)
m = (rec(i, k * A, k) for k in range(1, N + 1))
print((sum(m)))
# Original solution
import sys
from collections import deque, Counter

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, a = na()
x = na()
x = [0] + x
dp = [[[0] * (50 * n + 1) for i in range(n+1)] for j in range(n+1)]

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



# Optimized solution
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, a = na()
x = na()
x = [0] + x
dp = [[[0] * (50 * n + 1) for i in range(n+1)] for j in range(n+1)]

for j in range(n + 1):
    for k in range(j + 1):
        for s in range(50 * n + 1):
            if j == 0 and k == 0 and s == 0:
                dp[j][k][s] = 1
            elif j >= 1 and s < x[j]:
                dp[j][k][s] = dp[j - 1][k][s]
            elif j >= 1 and k >= 1 and s >= x[j]:
                dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j]]
            else:
                dp[j][k][s] = 0
print((sum([dp[n][k][k * a] for k in range(1, n+1)])))
# Original solution
def solve():
    def recur(i, n, total):
        # print("i, n, total", i, n, total)

        if not TABLE[i][n][total] == -1:
            # print('cache!')
            return TABLE[i][n][total]

        if not i < N:
            if n > 0 and total == A * n:
                TABLE[i][n][total] = 1
                return 1
            TABLE[i][n][total] = 0
            return 0

        ans1 = recur(i + 1, n, total)
        ans2 = recur(i + 1, n + 1, total + XS[i])

        # print(ans1, ans2)

        return ans1 + ans2

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

    TABLE = []
    for _ in range(N + 1):
        lines = [[-1 for x in range(N * 50 + 1)] for y in range(N + 1)]
        TABLE.append(lines)

    return recur(0, 0, 0)


if __name__ == '__main__':
    print((solve()))


# Optimized solution
def solve():
    def recur(i, n, total):
        # print("i, n, total", i, n, total)

        if not TABLE[i][n][total] == -1:
            # print('cache!')
            return TABLE[i][n][total]

        if not i < N:
            if n > 0 and total == A * n:
                return 1
            return 0

        ans1 = recur(i + 1, n, total)
        ans2 = recur(i + 1, n + 1, total + XS[i])

        # print(ans1, ans2)

        TABLE[i][n][total] = ans1 + ans2
        return TABLE[i][n][total]

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

    TABLE = []
    for _ in range(N + 1):
        lines = [[-1 for x in range(N * 50 + 1)] for y in range(N + 1)]
        TABLE.append(lines)

    return recur(0, 0, 0)


if __name__ == '__main__':
    print((solve()))
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, a = LI()
x = LI()

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

# Optimized solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, a = LI()
x = LI()

# dp[i][j][k] := i番目まで見たときj個使用してkを作る場合の数
dp = [[[0] * (2500+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
    xi = x[i-1]
    for j in range(2500+1):
        for k in range(i):
            dp[i][k][j] = dp[i-1][k][j]
    for j in range(xi, 2500+1):
        for k in range(1, i+1):
            dp[i][k][j] += dp[i-1][k-1][j-xi]
ans = 0
for i in range(1, n+1):
    ans += dp[-1][i][i*a]
print(ans)
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, a = LI()
x = LI()

# dp[i][j][k] := i番目まで見たときj個使用してkを作る場合の数
dp = [[[0] * (2500+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
    xi = x[i-1]
    for j in range(2500+1):
        for k in range(i):
            dp[i][k][j] = dp[i-1][k][j]
    for j in range(xi, 2500+1):
        for k in range(1, i+1):
            dp[i][k][j] += dp[i-1][k-1][j-xi]
ans = 0
for i in range(1, n+1):
    ans += dp[-1][i][i*a]
print(ans)

# Optimized solution
#!/usr/bin/env python3
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
s = sum(x)
dp = [[[0] * (s+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(1, n+1):
    xi = x[i-1]
    for j in range(s+1):
        for k in range(i):
            dp[i][k][j] = dp[i-1][k][j]
    for j in range(xi, s+1):
        for k in range(1, i+1):
            dp[i][k][j] += dp[i-1][k-1][j-xi]

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

dp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
  dp[i][0][0]=1
  for j in range(1,N+1):
    for k in range(1,sum(xlist)+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-xlist[i-1]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-xlist[i-1]]
#print(dp)

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

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

dp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
  dp[i][0][0]=1
  for j in range(1,i+1):
    for k in range(1,sum(xlist)+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-xlist[i-1]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-xlist[i-1]]
#print(dp)

answer=0
for j in range(1,N+1):
  if j*A>sum(xlist):
    break
  answer+=dp[N][j][j*A]
  
print(answer)
# Original solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
X=max(max(x),a)
dp=[[[0]*(n*X+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  xi=x[i-1]
  for j in range(n+1):
      for h in range(j*X+1):
        if h<xi:dp[i][j][h]=dp[i-1][j][h]
        if xi<=h and j>=1:dp[i][j][h]=dp[i-1][j][h]+dp[i-1][j-1][h-xi]
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)
dp=[[[0]*(X*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  xi=x[i-1]
  for j in range(i+1):
      for h in range(j*X+1):
        if h<xi:dp[i][j][h]=dp[i-1][j][h]
        if xi<=h and j>=1:dp[i][j][h]=dp[i-1][j][h]+dp[i-1][j-1][h-xi]
ans=0
for j in range(1,n+1):ans+=dp[n][j][j*a]
print(ans)
# Original solution
import itertools

n, a = list(map(int, input().split()))
integers = list(int(x) - a for x in input().split())
count = 0
for i in range(1, len(integers)+1):
    for combs in itertools.combinations(integers, i):
        av = sum(combs) / i
        if av == 0:
            count += 1

print(count)


# Optimized solution
import sys

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

def main():
    ma = a * n
    res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    res[0][0][0] = 1
    for i in range(n):
        cur = x[i]
        for j in range(i+2):
            for k in range(ma + 1):
                res[i+1][j][k] += res[i][j][k]
                if k >= cur:
                    res[i+1][j][k] += res[i][j-1][k-cur]
    
    ans = 0
    for j in range(1, n+1):
        ans += res[n][j][j*a]

    return ans

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

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

def main():
    ma = a * n
    res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    res[0][0][0] = 1
    for i in range(n):
        cur = x[i]
        for j in range(i+2):
            for k in range(ma + 1):
                res[i+1][j][k] += res[i][j][k]
                if k >= cur:
                    res[i+1][j][k] += res[i][j-1][k-cur]
    
    ans = 0
    for j in range(1, n+1):
        ans += res[n][j][j*a]

    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

# Optimized solution
import sys

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

def main():
    for i in range(n):
        x[i] -= a
    x.sort()

    res = [[0] * 99*n for _ in range(n+1)]
    # res[i][49*n]を中心とする。
    res[0][49*n] = 1
    for i in range(n):
        for j in range(99*n):
            res[i+1][j] += res[i][j]
            cur = x[i]
            if cur >= 0:
                if j >= cur:
                    res[i+1][j] += res[i][j-cur]
            else:
                if j - cur <= 99 * n - 1:
                    res[i+1][j] += res[i][j-cur]
    
    ans = res[n][49*n] - 1
    return ans
    
if __name__ == '__main__':
    ans = main()
    print(ans)
# Original solution
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))

X = max(x)
if X < A:
    X = A

def check(j, k, s):
    if dp[j][k][s] != -1:
        return dp[j][k][s]
    if j == 0 and k == 0 and s == 0:
        dp[j][k][s] = 1
        return 1
    if j >= 1 and s < x[j-1]:
        a = check(j-1, k ,s)
        dp[j][k][s] = a
        return a
    if j >= 1 and k >= 1 and s >= x[j-1]:
        a = check(j-1, k, s) + check(j-1, k-1, s-x[j-1])
        dp[j][k][s] = a
        return a
    dp[j][k][s] = 0
    return 0
        
dp = [[[-1] * (N*X+1) for _ in range(N+1)] for _ in range(N + 1)]
# dp = np.array(dp)
# print (dp)
# for j in range(N+1):
#     for k in range(N+1):
#         for s in range(N*X + 1):
#             print (j, k, s)
#             dp[j][k][s] = check(j, k, s)

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

print (ans)

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

X = max(x)
if X < A:
    X = A
    
y = []
for i in x:
    y += [i-A]

dp = [[-1] * (2*N*X+1) for _ in range(N+1)]

def check(j, t):
    if dp[j][t] != -1:
        return dp[j][t]
    if  j == 0 and t == N * X:
        dp[j][t] = 1
        return 1
    if j >= 1 and (t-y[j-1] < 0 or t-y[j-1] > 2 * N * X):
        dp[j][t] = check(j-1, t)
        return dp[j][t]
    if j >= 1 and 0 <= t-y[j-1] and t-y[j-1] <= 2*N*X:
        dp[j][t] = check(j-1, t) + check(j-1, t- y[j-1])
        return dp[j][t]
    dp[j][t] = 0
    return 0

print((check(N, N*X)-1))
# Original solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [[[0 for s in range(n * 60)] for k in range(n + 1)] for j in range(n + 1)]
for j in range(n + 1):
    for k in range(n + 1):
        for s in range(n * 60):
            if (j == 0) and (k == 0) and (s == 0):
                dp[j][k][s] = 1
            elif (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]]
ans = 0
for k in range(1, n + 1):
    ans += dp[j][k][k * a]
print(ans)

# Optimized solution
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(x)
y = [i - a for i in x]
dp = [[0 for t in range(2 * n * X + 10)] for j in range(n + 1)]
dp[0][n * X] = 1
for j in range(1, n + 1):
    for t in range(2 * n * X + 1):
        if 0 <= 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] = dp[j - 1][t]
print((dp[n][n * X] - 1))
# Original solution
from sys import stdin
input = stdin.readline

def Combi(n, r):
	return int(factorial[n] / factorial[r] / factorial[n-r])
N, A = [int(x) for x in input().rstrip().split()]
x = [int(x) for x in input().rstrip().split()]
# num = [0]*51
# for i in x:
# 	num[i] += 1
# print(2**num[A]-1)
# factorial = [1]
# for i in range(1, 51):
# 	factorial.append(factorial[i-1] * i)
# for i in range(1, A):
X = max(max(x), A)
dp = [[[0]*(N*X+1) for _ in range(N+1)] for _ in range(N+1)]
for j in range(N+1):
	for k in range(N+1):
		for s in range(N*X+1):
			if j == 0 and k == 0 and s == 0:
				dp[j][k][s] = 1
			elif j >= 1 and s < 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
sum = 0
for i in range(N+1):
	sum += dp[N][i][i*A]
print((sum-1))


# Optimized solution
from sys import stdin
input = stdin.readline

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

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

dp = [[0]*(2*N*X+1) for _ in range(N+1)]
y = [0] * len(x)
for i in range(len(x)):
	y[i] = x[i]-A

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 0 <= 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
N,A = list(map(int,input().split()))
X = [0]+list(map(int,input().split()))

# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(2501)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1

for n in range(1,N+1):
    for k in range(n+1):
        for s in range(50*k+1):
            if n>=1 and s<X[n]:
                dp[n][k][s] = dp[n-1][k][s]
            elif n>=1 and k>=1 and s>=X[n]:
                dp[n][k][s] = dp[n-1][k][s] + dp[n-1][k-1][s-X[n]]

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 = [0]+list(map(int,input().split()))

# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(2501)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1

for n in range(1,N+1):
    for k in range(n+1):
        for s in range(50*k+1):
            if s<X[n]:
                dp[n][k][s] = dp[n-1][k][s]
            elif k>=1 and s>=X[n]:
                dp[n][k][s] = dp[n-1][k][s] + dp[n-1][k-1][s-X[n]]

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

print(Ans)
# Original solution
N,A = list(map(int,input().split()))
X = [0]+list(map(int,input().split()))

# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(2501)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1

for n in range(1,N+1):
    for k in range(n+1):
        for s in range(50*k+1):
            if s<X[n]:
                dp[n][k][s] = dp[n-1][k][s]
            elif k>=1 and s>=X[n]:
                dp[n][k][s] = dp[n-1][k][s] + dp[n-1][k-1][s-X[n]]

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

print(Ans)

# Optimized solution
# python3 (3.4.3)
import sys
input = sys.stdin.readline

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

# dp[n][k][d] : n枚からk枚選んで合計dにする選び方
dp = [[[0 for _ in range(50*N+1)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1

for n in range(N+1):
    for k in range(n+1):
        for d in range(50*k+1):
            # 選んだ数がn枚目のカードより小さい場合, そのカードは使えない
            if d < X[n]:
                dp[n][k][d] = dp[n-1][k][d]
            # そうでない場合
            else:
                # k==0のときはカードを選べないことに注意
                if k >= 1:
                    dp[n][k][d] = dp[n-1][k][d] + dp[n-1][k-1][d-X[n]]

ans = 0
for i in range(1,N+1):
    # N枚からi枚選んで平均がA,つまり合計がA*i
    ans += dp[N][i][A*i]

print(ans)
# Original solution
n,v = list(map(int,input().split()))
X = list(map(int,input().split()))

ans = [[0,0]] 

for i in range(n):
    ans2 = []
    for x in ans:
        ans2.append([x[0]+X[i],x[1]+1])
        ans2.append([x[0],x[1]])
    ans = ans2

cnt = 0
for a in ans:
    if a[1] == 0:
        continue
    elif a[0]/a[1] == v:
        cnt += 1

print(cnt)


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

X = [int(i)-a for i in input().split()]
dp = [[0]*(100*n+1) for i in range(n+1)]
dp[0][50*n] = 1

for i in range(n):
    for j in range(50,100*n+1-50):
        dp[i+1][j] = dp[i][j]+dp[i][j-X[i]]

print((dp[n][50*n]-1))
# Original solution


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    OPT[i][j][k] - sum is i, j number of elements, first k elements
    OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
                   OPT[i][j][k-1]

    OPT[A*j][j][k] for all k
    """
    N, A = read_ints()
    x = read_ints()
    OPT = [[[0 for _ in range(51)] for _ in range(51)] for _ in range(2501)]
    for k in range(N+1):
        OPT[0][0][k] = 1
    for i in range(len(OPT)):
        for j in range(1, N+1):
            for k in range(1, N+1):
                if i-x[k-1] >= 0:
                    OPT[i][j][k] += OPT[i-x[k-1]][j-1][k-1]
                OPT[i][j][k] += OPT[i][j][k-1]
    T = 0
    for j in range(1, N+1):
        T += OPT[A*j][j][N]
    return T


if __name__ == '__main__':
    print((solve()))


# Optimized solution


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    OPT[i][j][k] - sum is i, j number of elements, first k elements
    OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
                   OPT[i][j][k-1]

    OPT[A*j][j][k] for all k
    """
    N, A = read_ints()
    x = read_ints()
    OPT = [[[0 for _ in range(N+1)] for _ in range(N+1)] for _ in range(N*max(x)+1)]
    for k in range(N+1):
        OPT[0][0][k] = 1
    for i in range(len(OPT)):
        for j in range(1, N+1):
            for k in range(j, N+1):
                if i-x[k-1] >= 0:
                    OPT[i][j][k] += OPT[i-x[k-1]][j-1][k-1]
                OPT[i][j][k] += OPT[i][j][k-1]
    T = 0
    for j in range(1, N+1):
        if A*j < len(OPT):
            T += OPT[A*j][j][N]
    return T


if __name__ == '__main__':
    print((solve()))
# Original solution
import copy
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):
        dpn = copy.deepcopy(dp)
        for i in range(k+1):
            for j in range(50 * N + 1 -x[k]):
                dpn[i+1][j+x[k]] += dp[i][j]
        dp = dpn
    r = 0
    for i in range(1, N+1):
        r += dp[i][i*A]
    return r
print((main()))


# Optimized solution
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()))