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: N, A = map(int, input().split())
  x = sorted(list(map(int, input().split())))
  
  xn = [x[i] - A for i in range(len(x)) if x[i] < A]
  xn.reverse()
  x0 = [0 for i in range(len(xn), len(x)) if x[i] == A]
  xp = [x[i] - A for i in range(len(xn) + len(x0), len(x)) if x[i] > A]
  
  sxn = [0]
  sxn_n = [1]
  for x in xn:
      sxn_add = []
      sxn_n_i = []
      for j in range(len(sxn)):
          sxn_tmp = sxn[j] + x
          for k in range(len(sxn)):
              if sxn[k] <= sxn_tmp or k == len(sxn) - 1:
                  if sxn[k] == sxn_tmp:
                      sxn_n_i.append([k, sxn_n[j]])
                  elif sxn[k] < sxn_tmp:
                      sxn_add.append([k, sxn_tmp, sxn_n[j]])
                  else:
                      sxn_add.append([k + 1, sxn_tmp, sxn_n[j]])
                  break
      for k in range(len(sxn_add)):
          sxn.insert(k + sxn_add[k][0], sxn_add[k][1])
          sxn_n.insert(k + sxn_add[k][0], 1)
      for l in sxn_n_i:
          sxn_n[l[0]] += l[1]
  
  sxp = [0]
  sxp_n = [1]
  for x in xp:
      sxp_add = []
      sxp_n_i = []
      for j in range(len(sxp)):
  
          sxp_tmp = sxp[j] + x
  
          for k in range(len(sxp)):
              if sxp[k] >= sxp_tmp or k == len(sxp) - 1:
  
                  if sxp[k] == sxp_tmp:
                      sxp_n_i.append([k, sxp_n[j]])
                  elif sxp[k] > sxp_tmp:
                      sxp_add.append([k, sxp_tmp, sxp_n[j]])
                  else:
                      sxp_add.append([k + 1, sxp_tmp, sxp_n[j]])
                  break
  
      for k in range(len(sxp_add)):
          sxp.insert(k + sxp_add[k][0], sxp_add[k][1])
          sxp_n.insert(k + sxp_add[k][0], sxp_add[k][2])
      for l in sxp_n_i:
          sxp_n[l[0]] += l[1]
  
  
  an = 0
  for i in range(1, len(sxp)):
      for j in range(1, len(sxn)):
  
          if sxp[i] == -sxn[j]:
              an += sxp_n[i] * sxn_n[j]
              break
  
  
  print(2 ** len(x0) - 1 + an * 2 ** (len(x0)))
  
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."}]