output_description: Print the number of ways to select cards such that the average of the written
  integers is exactly A.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N A
      x_1 x_2 ... x_N
attempt: 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
  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)
  
  # ここから書き始める
  n, a = map(int, input().split())
  x = list(map(int, input().split()))
  if n == 1:
      if x[0] == a:
          print(1)
      else:
          print(0)
  else:
  for i in range(n):
      x[i] -= a
  # x.sort()
  dp = [[0 for j in range(99)] for i in range(n)]
  # print(dp)
  for i in range(n):
      if i == 0:
          dp[i][49] = 1
          dp[i][x[i] + 49] += 1
          continue
      for j in range(99):
          dp[i][j] = dp[i - 1][j]
          if 0 <= j - x[i] <= 98:     
              dp[i][j] += dp[i - 1][j - x[i]]
  ans = dp[-1][49]
  # for i in range(n):
      # print(dp[i])
  print(ans - 1)
problem_description: Statement
  
  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?
samples: [{"input": "4 8\n    7 9 8 9", "output": "5\n    \n\n  * The following are the 5 ways to select cards such that the average is 8:\n    * Select the 3-rd card.\n    * Select the 1-st and 2-nd cards.\n    * Select the 1-st and 4-th cards.\n    * Select the 1-st, 2-nd and 3-rd cards.\n    * Select the 1-st, 3-rd and 4-th cards.\n\n* * *"}, {"input": "3 8\n    6 6 9", "output": "0\n    \n\n* * *"}, {"input": "8 5\n    3 6 2 8 7 6 5 9", "output": "19\n    \n\n* * *"}, {"input": "33 3\n    3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3", "output": "8589934591\n    \n\n  * The answer may not fit into a 32-bit integer."}]