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: def solve():
      def recur(i, n, total):
          # print("i, n, total", i, n, total)
  
          if not TABLE[i][n][total] == -1:
              return TABLE[i][n][total]
  
          if not i < N:
              if n > 0 and total == A * n:
                  TABLE[i][n][total] = 1
                  return TABLE[i][n][total]
  
              TABLE[i][n][total] = 0
              return TABLE[i][n][total]
  
          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())
  
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."}]