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: # 正負で分割
  # dpの作り方はARCの方の人のロジックを参考にした。
  # こんなんでええんや...
  def 解():
      iN, iA = [int(x) for x in input().split()]
      aX = [int(x) - iA for x in input().split()]
      aPlus = [x for x in aX if 0 < x]
      aMinus = [-1 * x for x in aX if x < 0]
      iLenPlus = len(aPlus)
      iLenMinus = len(aMinus)
      iLen0 = iN - iLenPlus - iLenMinus
  
      iCZero = 2**iLen0  # sum(k=1..N){nCk} = 2^n -1 #1は組み合わせ0の場合
      iRet = 0
      iUlim = min(sum(aPlus), sum(aMinus))
      if 0 < iUlim:
          dp1 = {0: 1}
          for iX in aPlus:
              for k, v in dp1.copy().items():
                  dp1[k + iX] = dp1.get(k + iX, 0) + v
          dp2 = {0: 1}
          for iX in aMinus:
              for k, v in dp2.copy().items():
                  dp2[k + iX] = dp2.get(k + iX, 0) + v
          for i in range(1, iUlim + 1):
              if i in dp1 and i in dp2:
                  iRet += dp1[i] * dp2[i]
      print((iRet + 1) * iCZero - 1)  # 組み合わせ0の場合を引く
  
  
  解()
  
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."}]