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 = list(map(int, input().split()))
  
  for i in range(n):
      x[i] = x[i] - a
  
  n2 = n // 8
  n3 = n - n2 * 8
  
  # n2=n//4
  # n3=n-n2*4
  
  y1 = []
  y2 = []
  y3 = []
  y4 = []
  y5 = []
  y6 = []
  y7 = []
  y8 = []
  for i in range(n2):
      y1.append(x[i])
      y2.append(x[i + n2])
      y3.append(x[i + n2 * 2])
      y4.append(x[i + n2 * 3])
      y5.append(x[i + n2 * 4])
      y6.append(x[i + n2 * 5])
      y7.append(x[i + n2 * 6])
      y8.append(x[i + n2 * 7])
  y9 = []
  for i in range(n3):
      y9.append(x[i + n2 * 4])
  
  
  # itertools 使用 bit全探索
  import itertools
  
  
  def xdic(n2, xx):
      xsum = dict()
      for i in itertools.product([0, 1], repeat=n2):
          isum = 0
          for ii in range(n2):
              if i[ii] == 0:
                  isum = isum + xx[ii]
          if isum in xsum:
              xsum[isum] = xsum[isum] + 1
          else:
              xsum[isum] = 1
      return xsum
  
  
  xsum1 = xdic(n2, y1)
  xsum2 = xdic(n2, y2)
  xsum3 = xdic(n2, y3)
  xsum4 = xdic(n2, y4)
  xsum5 = xdic(n2, y5)
  xsum6 = xdic(n2, y6)
  xsum7 = xdic(n2, y7)
  xsum8 = xdic(n2, y8)
  xsum9 = xdic(n3, y9)
  
  # xsum[0]=xsum[0]
  # print(xsum)
  
  icnt = 0
  for xs1 in xsum1.items():
      for xs2 in xsum2.items():
          for xs3 in xsum3.items():
              for xs4 in xsum4.items():
                  for xs5 in xsum5.items():
                      for xs6 in xsum6.items():
                          for xs7 in xsum7.items():
                              for xs8 in xsum8.items():
                                  for xs9 in xsum9.items():
                                      if (
                                          xs1[0]
                                          + xs2[0]
                                          + xs3[0]
                                          + xs4[0]
                                          + xs5[0]
                                          + xs6[0]
                                          + xs7[0]
                                          + xs8[0]
                                          + xs9[0]
                                          == 0
                                      ):
                                          icnt = (
                                              icnt
                                              + xs1[1]
                                              * xs2[1]
                                              * xs3[1]
                                              * xs4[1]
                                              * xs5[1]
                                              * xs6[1]
                                              * xs7[1]
                                              * xs8[1]
                                              * xs9[1]
                                          )
  
  print(icnt - 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."}]