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?

-----Constraints-----
 - 1 \leq N \leq 50
 - 1 \leq A \leq 50
 - 1 \leq x_i \leq 50
 - N,\,A,\,x_i are integers.

-----Partial Score-----
 - 200 points will be awarded for passing the test set satisfying 1 \leq N \leq 16.

-----Input-----
The input is given from Standard Input in the following format:
N A
x_1 x_2 ... x_N

-----Output-----
Print the number of ways to select cards such that the average of the written integers is exactly A.

-----Sample Input-----
4 8
7 9 8 9

-----Sample Output-----
5

 - The following are the 5 ways to select cards such that the average is 8:
 - Select the 3-rd card.
 - Select the 1-st and 2-nd cards.
 - Select the 1-st and 4-th cards.
 - Select the 1-st, 2-nd and 3-rd cards.
 - Select the 1-st, 3-rd and 4-th cards.
[{"code": "def abc044_c():\n    #\u5024\u5165\u529b\n    _, A = map(int, input().split())\n    X = list(map(lambda x : int(x)-A,input().split()))\n    #\u521d\u671f\u5024\n    d = {0:1}\n    for x in X:\n        for k,v in list(d.items()):\n            d[k + x] = d.get(k + x,0) + v #\u5dee\u5206\u306e\u5408\u8a08\n    ans = d[0] - 1 #\u5dee\u5206\u5408\u8a080\u3067\u521d\u671f\u5024\u3092\u9664\u304f\n    print(ans)\n\ndef __starting_point():\n    abc044_c()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "ma = lambda :map(int,input().split())\nlma = lambda :list(map(int,input().split()))\ntma = lambda :tuple(map(int,input().split()))\nni = lambda:int(input())\nyn = lambda fl:print(\"Yes\") if fl else print(\"No\")\nimport collections\nimport math\nimport itertools\nimport heapq as hq\ndef ncr(n,r):\n    ret = 1\n    if n<r:\n        return 0\n    if n-r <r:\n        r = n-r\n    for i in range(1,r+1):\n        ret*=(n-r+i)\n        ret//=i\n    return ret\n\nn,a = ma()\nX = lma()\nfor i in range(n):\n    X[i] -= a\nco = collections.Counter(X)\nans = 0\nmx = 49*n #\u305a\u308c\u306e\u6700\u5927\u306fA=1,x=50 2*mx +1\u3053\u306e\u914d\u5217\ndp = [[0 for j in range(-mx,mx+1)] for i in range(n+1)]# dp[i][j] i\u307e\u3067\u4f7f\u3063\u3066\u5024\u3092j\u306b\u3059\u308b\u7d44\u307f\u5408\u308f\u305b\ndp[-1][0] = 1 #\u4e00\u500b\u3082\u4f7f\u308f\u306a\u3044\u7d44\u307f\u5408\u308f\u305b\nfor i in range(n):\n    x = X[i]\n    #print(x)\n    for j in range(-mx,mx+1,1):\n        dp[i][j] += dp[i-1][j] + dp[i-1][j-x] #\u9078\u3070\u306a\u3044/\u3076\n        #if j==0:print(i,j,dp[i-1][j] , dp[i-1][j-x])\nprint(dp[n-1][0]-1)\n", "passed": true, "time": 0.17, "memory": 14200.0, "status": "done"}, {"code": "n, a = list(map(int, input().split()))\nx = list(map(int, input().split()))\n\ndp = [[[0] * (50 * (n + 10)) for _ in range(n + 10)] for _ in range(n + 10)]\ndp[0][0][0] = 1\n\nfor i in range(n):\n    for use in range(n):\n        for total in range(n * a):\n            if dp[i][use][total]:\n                dp[i + 1][use][total] += dp[i][use][total]\n                dp[i + 1][use + 1][total + x[i]] += dp[i][use][total]\n\nans = 0\nfor i in range(1, n + 1):\n    ans += dp[n][i][a * i]\n\nprint(ans)\n", "passed": true, "time": 0.27, "memory": 42940.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nx = list(map(int, input().split()))\nx = [i - a for i in x]\ndic = {0:1}\nfor i in x:\n    for j, k in list(dic.items()):\n        dic[i+j] = dic.get(i+j, 0) + k\n\nprint(dic[0] - 1)", "passed": true, "time": 0.24, "memory": 14244.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, A, *X = list(map(int, read().split()))\n\n    X = [x - A for x in X]\n\n    base = 2500\n    dp = [0] * 5001\n    dp[base] = 1\n    for i in range(N):\n        dp, dp_prev = dp[:], dp\n        for j in range(5001):\n            if 0 <= j - X[i] <= 5000:\n                dp[j] += dp_prev[j - X[i]]\n\n    print((dp[base] - 1))\n\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.19, "memory": 14300.0, "status": "done"}, {"code": "from collections import defaultdict\nimport io\n\nnim, mike = map(int, input().split())\nkite = list(map(int, input().split()))\nfor i in range(nim):\n    kite[i] -= mike\nqwe = defaultdict(int)\nqwe[0] = 1\nfor o in kite:\n    for j, c in list(qwe.items()):\n        qwe[j + o] += c\nprint(qwe[0]-1)", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "def solve():\n    N, A = list(map(int, input().split()))\n    X = list(map(int, input().split()))\n \n    dp = [[0] * (A * N + 1) for _ in range(N + 1)]\n    dp[0][0] = 1\n    for i, x in enumerate(X):\n        for j in reversed(list(range(1, i + 2))):\n            for a in range(x, A * N + 1):\n                dp[j][a] += dp[j - 1][a - x]\n    print((sum(dp[i][A * i] for i in range(1, N + 1))))\n \nsolve()\n", "passed": true, "time": 0.22, "memory": 14248.0, "status": "done"}, {"code": "n, a = list(map(int, input().split()))\nx = [int(i)-a for i in input().split()]\n\ndp = {0: 1}\n\nfor i in x:\n    tmp = list(dp.items())\n    for key, value in tmp:\n        dp[key+i] = dp.get(key+i, 0) + value\nprint((dp[0] - 1))\n\n\n", "passed": true, "time": 0.15, "memory": 14040.0, "status": "done"}, {"code": "def abc044_c():\n    ''' \u904e\u53bb\u63d0\u51fa\u3092\u53c2\u8003\u306b '''\n    _, A = map(int, input().split())\n    X = list(map(lambda x: int(x) - A, input().split()))\n    d = {0: 1}  # \u8ca0\u306e\u5024\u3092\u53d6\u308a\u5f97\u308b\u305f\u3081\u3001\u914d\u5217\u3067\u306a\u304f\u8f9e\u66f8\u3067\u6301\u3064\n    for x in X:\n        prev = list(d.items())  # \u524d\u306e\u30bf\u30fc\u30f3\u306e\u3076\u3093\u3092\u4fdd\u6301\u3057\u3066\u304a\u304f\n        for val, cnt in prev:\n            d[val + x] = d.get(val + x, 0) + cnt\n    ans = d[0] - 1\n    print(ans)\n\ndef __starting_point():\n    abc044_c()\n__starting_point()", "passed": true, "time": 0.24, "memory": 14060.0, "status": "done"}, {"code": "n, a = list(map(int, input().split()))\nxxx = list(map(int, input().split()))\nlimit = a * n\ndp = [[0] * (limit + 1) for i in range(n + 1)]\ndp[0][0] = 1\nfor i, x in enumerate(xxx):\n    if x > limit:\n        continue\n    for j in range(i, -1, -1):\n        for k in range(limit - x, -1, -1):\n            dp[j + 1][k + x] += dp[j][k]\n\nprint((sum(dp[i][i * a] for i in range(1, n + 1))))\n", "passed": true, "time": 0.25, "memory": 14332.0, "status": "done"}, {"code": "#\n# Written by NoKnowledgeGG @YlePhan\n# ('\u03c9')\n#\n#import math\n#mod = 10**9+7\n#import itertools\n#import fractions\n#import numpy as np\n#mod = 10**4 + 7\ndef kiri(n,m):\n  r_ = n / m\n  if (r_ - (n // m)) > 0:\n    return (n//m) + 1\n  else:\n    return (n//m)\n\n\"\"\" n! mod m \u968e\u4e57\nmod = 1e9 + 7\nN = 10000000\nfac = [0] * N\ndef ini():\n  fac[0] = 1 % mod\n  for i in range(1,N):\n    fac[i] = fac[i-1] * i % mod\"\"\"\n\n\"\"\"mod = 1e9+7\nN = 10000000\npw = [0] * N\ndef ini(c):\n  pw[0] = 1 % mod\n  for i in range(1,N):\n    pw[i] = pw[i-1] * c % mod\"\"\"\n\n\"\"\"\ndef YEILD():\n  yield 'one'\n  yield 'two'\n  yield 'three'\ngenerator = YEILD()\nprint(next(generator))\nprint(next(generator))\nprint(next(generator))\n\"\"\"\n\"\"\"def gcd_(a,b):\n  if b == 0:#\u7d50\u5c40\u306fc,0\u306e\u6700\u5927\u516c\u7d04\u6570\u306fc\u306a\u306e\u306b\n    return a\n  return gcd_(a,a % b) # a = p * b + q\"\"\"\n\"\"\"def extgcd(a,b,x,y):\n  d = a\n  if b!=0:\n    d = extgcd(b,a%b,y,x)\n    y -= (a//b) * x\n    print(x,y)\n  else:\n    x = 1\n    y = 0\n  return d\"\"\"\n\n\ndef readInts():\n  return list(map(int,input().split()))\n\ndef main():\n  n,a = readInts()\n  \n  X = readInts()\n  \n  X = list(map(lambda i: i-a, X))# lambda i\u306b\u3001 i - a\u3068\u3044\u3046\u6f14\u7b97\u306e\u3082\u3068 X\u304b\u3089\u5165\u308c\u308b\n  # \u3053\u3053\u3067\u3001\u5e73\u5747\u304c8\u306b\u306a\u308b\u3082\u306e key = 0\u306e\u6642\u304c\u7b54\u3048\u306b\u306a\u308b\u3002\n  # \u3060\u304b\u3089\u3053\u305d\u3000\u7b54\u3048\u3067 dp[0] - 1 \u3059\u308b\u306e\u306f\u3053\u306e\u305f\u3081\n  \n  dp = {0:1} \n  \n  for i in X:\n    for k,v in list(dp.items()): # key,value\u3092\u305d\u308c\u305e\u308c\u62bd\u51fa\n      dp[i+k] = dp.get(i+k, 0) + v\n      #\n      # get(\u306a\u3093\u304b) \u306a\u3093\u304b\u306b\u5165\u3063\u3066\u308b\u8f9e\u66f8\u306evalue\u304c\u8fd4\u3063\u3066\u304f\u308b\n      # \u7121\u304b\u3063\u305f\u3089\u3001get(\u306a\u3093\u304b,\u3007)\u3067\u3001\u3007\u306b\u5165\u3063\u3066\u308b\u306e\u3067\u8f9e\u66f8\u304c\u66f4\u65b0\u3055\u308c\u308b\n      # \n  # print(dp)\n  #{0: 6, 1: 6, 2: 2, -1: 2}\n  # \u8ca0\u306e\u6570\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u308b\n  print(dp[0]-1)\n  \ndef __starting_point():\n  main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "from collections import defaultdict\nN, A = map(int, input().split())\nX = list(map(int, input().split()))\n\ndp = defaultdict(dict)\ndp[0][0] = 1  # \u30ab\u30fc\u30c90\u679a\u3067\u5408\u8a08\n\nfor x in X:\n    newDP = defaultdict(dict)\n    for card, memo in dp.items():\n        for k, v in memo.items():\n            # \u30ab\u30fc\u30c9X\u3092\u8ffd\u52a0\u3057\u306a\u3044\n            if k in newDP[card]:\n                newDP[card][k] += v\n            else:\n                newDP[card][k] = v\n            # \u30ab\u30fc\u30c9X\u3092\u8ffd\u52a0\u3059\u308b\u3088\n            if k + x in newDP[card + 1]:\n                newDP[card + 1][k + x] += v\n            else:\n                newDP[card + 1][k + x] = v\n    dp = newDP\n\nans = 0\nfor i in range(1, N + 1):\n    if A * i in dp[i]:\n        ans += dp[i][A * i]\nprint(ans)", "passed": true, "time": 0.2, "memory": 14156.0, "status": "done"}, {"code": "\nNMAX = 55\n\nN, A = list(map(int, input().split()))\nX = list(map(int, input().split()))\n\ndp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]\n\ndp[0][0][0] = 1 # dp[i][s][k]: i\u500b\u304b\u3089k\u500b\u9078\u3076\u3068\u304d\u3001\u7dcf\u548c\u304cs\u306e\u3082\u306e\u306e\u500b\u6570\nfor i in range(N): # N-1\u6642\u70b9\u3067N\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u3067\u3053\u3053\u307e\u3067\u3067\u5341\u5206\n    for s in range(N*A+1):\n        for k in range(N+1):\n            if dp[i][s][k] == 0:\n                continue\n            dp[i+1][s][k] += dp[i][s][k]\n            dp[i+1][s+X[i]][k+1] += dp[i][s][k]\n\nans = 0\nfor k in range(1, N+1):\n    ans += dp[N][A*k][k]\n\nprint(ans)\n", "passed": true, "time": 1.13, "memory": 97128.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nfrom collections import Counter, defaultdict\n\n\ndef main():\n    N, A = list(map(int, input().split()))\n    X = [int(x) - A for x in input().split()]\n\n    result = Counter([0])\n\n    for x in X:\n        dct = defaultdict(int)\n        for k, v in list(result.items()):\n            dct[k + x] += v\n        result += dct\n\n    print((result[0] - 1))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "N,A = (int(T) for T in input().split())\nX = [int(T) for T in input().split()]\nDP = [[[0]*(N+1) for TS in range(0,50*N+1)] for TI in range(0,N+1)]\nDP[0][0][0] = 1\nfor TI in range(0,N):\n    for TS in range(0,50*N+1):\n        for TK in range(0,N+1):\n            if DP[TI][TS][TK]!=0:\n                DP[TI+1][TS][TK] += DP[TI][TS][TK]\n                DP[TI+1][TS+X[TI]][TK+1] += DP[TI][TS][TK]\nprint(sum(DP[N][A*TA][TA] for TA in range(1,N+1)))", "passed": true, "time": 0.29, "memory": 32808.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nx = list(map(int, input().split()))\nfor i in range(n):\n    x[i] -= a\ndp = [[0 for i in range(100 * n + 1)] for j in range(n + 1)]\ndp[0][50 * n] = 1\nfor i in range(n):\n    for j in range(100 * n + 1):\n        j2 = j - 50 * n\n        num = x[i]\n        if -50 * n <= j2 - num <= 50 * n:\n            dp[i + 1][j] = dp[i][j] + dp[i][j - num]\n        else:\n            dp[i + 1][j] = dp[i][j]\nprint(dp[n][50 * n] - 1)", "passed": true, "time": 0.29, "memory": 14192.0, "status": "done"}, {"code": "N,A = map(int,input().split())\nX = list(map(int,input().split()))\nY = [x-A for x in X]\ndp = {0:1}\n\nfor y in Y:\n  for k,v in list(dp.items()):\n    dp[k+y]=dp.get(k+y,0)+v\n\nprint(dp[0]-1)", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "N, A = map(int, input().split())\n\nx = list(map(int, input().split()))\n\nmaxint = 50 * N\n\ndp = [[[0] * (maxint + 1) for _ in range(N + 1)] for _ in range(N + 1)]\n\ndp[0][0][0] = 1\n\nfor xi, xe in enumerate(x, 1):\n    for j in range(xi+1):\n        for k in range(maxint + 1):\n            dp[xi][j][k] = dp[xi - 1][j][k]\n            \n            if j >= 0 and k >= xe:\n                dp[xi][j][k] += dp[xi - 1][j - 1][k - xe]\n                \n\nres = 0\n\nfor i in range(1, N+1):\n    res += dp[N][i][i * A]\n\nprint(res)", "passed": true, "time": 0.69, "memory": 26380.0, "status": "done"}, {"code": "N,A = list(map(int,input().split()))\nX = list(map(int,input().split()))\ndp = [[[0 for _ in range(50*(N+2))] for _ in range(N+2)] for _ in range(N+2)]\n\ndp[0][0][0] = 1\n#k\u307e\u3067\u307f\u305f\nfor k in range(N):\n    #used\u500b\u4f7f\u3063\u305f\n    for used in range(N):\n        for i in range(50*N):\n            #\u4f7f\u3046\u6642\n            if dp[used][k][i] == 0: \n                continue\n            dp[used+1][k+1][i+X[k]] += dp[used][k][i]\n            dp[used][k+1][i] += dp[used][k][i]\nans = 0\nfor used in range(1,N+1):\n    ans += dp[used][N][used*A]\nprint(ans)\n\n\n", "passed": true, "time": 0.32, "memory": 28988.0, "status": "done"}, {"code": "n,a=map(int,input().split())\nnums=[int(i)-a for i in input().split()]\nd={0:1}\nfor i in nums:\n  s = [[j, d[j]] for j in d]\n  for j in s:\n    if j[0] + i in d:\n      d[j[0]+i] += j[1]\n    else:\n      d[j[0]+i] = j[1]\nprint(d[0]-1)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "def c_tak_and_cards():\n    from collections import defaultdict\n    N, A = [int(i) for i in input().split()]\n    X = [int(i) for i in input().split()]\n\n    average = [x - A for x in X]\n    dp = defaultdict(int)  # dp[s]: y \u304b\u3089 1 \u679a\u4ee5\u4e0a\u9078\u3093\u3067\u6574\u6570\u306e\u548c\u3092 s \u306b\u3059\u308b\u65b9\u6cd5\n    dp[0] = 1  # \u300c\u9078\u3070\u306a\u3044\u300d 1 \u901a\u308a\n    for y in average:\n        for k, v in list(dp.items()):  # for \u6587\u4e2d\u3067\u8981\u7d20\u6570\u304c\u5909\u308f\u3063\u3066\u306f\u3044\u3051\u306a\u3044\u305f\u3081\n            dp[k + y] += v\n    return dp[0] - 1\n\nprint(c_tak_and_cards())", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nN, A = map(int, input().split())\nX = list(map(int, input().split()))\n\ndp = [[0] * (N * A + 1) for _ in range(N + 1)]\n\ndp[0][0] = 1\n\nfor i in range(0, N):\n    for cnt in range(N, 0, -1):\n        for val in range(N * A, -1, -1):\n            if val - X[i] >= 0:\n                dp[cnt][val] += dp[cnt - 1][val - X[i]]\n\nans = 0\nfor i in range(1, N + 1):\n    ans += dp[i][i * A]\n\nprint(ans)", "passed": true, "time": 0.17, "memory": 14348.0, "status": "done"}, {"code": "def abc044_c():\n    N, A = map(int, input().split())\n    X = list(map(lambda x: int(x) - A, input().split()))  # \u5e73\u5747\u30bf\u30fc\u30b2\u30c3\u30c8\u3092\u5f15\u3044\u305f\u72b6\u614b\n    dp = [dict() for _ in range(N+1)]  # \u8ca0\u306e\u5024\u3092\u53d6\u308a\u5f97\u308b\u305f\u3081\u3001\u914d\u5217\u3067\u306a\u304f\u8f9e\u66f8\u3067\u6301\u3064\n    dp[0][0] = 1  # 0\u679a\u6642\u70b9\u3067\u4f55\u3082\u9078\u3070\u306a\u3044\u3001\u3092\u521d\u671f\u5024\u3068\u3059\u308b\n    for i, x in enumerate(X):\n        dp[i+1] = dp[i].copy()  # \u524d\u306e\u72b6\u614b\u3092\u5f15\u304d\u7d99\u3050\n        for val, cnt in dp[i].items():\n            dp[i+1][val + x] = dp[i].get(val + x, 0) + cnt  # \u524d\u306e\u30bf\u30fc\u30f3\u306ex\u30b7\u30d5\u30c8\u5206\u3092\u52a0\u7b97\n    ans = dp[N][0] - 1\n    print(ans)\n\ndef __starting_point():\n    abc044_c()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "import sys\n\nn,a=list(map(int, input().split()))\ncards=list(map(int, input().split()))\n\nintegers=[x-a for x in cards]\ncards.append(a)\nf=max(cards)*n\n\n\ndp=[[0 for i in range(n+1)] for j in range(2*f+1) ]\n\nfor y in range(n+1):\n    for x in range(2*f+1):\n        if y==0 and x==f:\n            dp[x][y]=1\n        elif y>0 and (x-integers[y-1]<0 or x-integers[y-1]>2*f):\n            dp[x][y]=dp[x][y-1]\n        elif y>0 and x-integers[y-1]>=0 and x-integers[y-1]<=2*f:\n            dp[x][y]=dp[x-integers[y-1]][y-1]+dp[x][y-1]\n        else:\n            dp[x][y]=0\nprint((dp[f][n]-1))\n\n", "passed": true, "time": 0.15, "memory": 14312.0, "status": "done"}, {"code": "n,a,=map(int,input().split())\nx=list(map(lambda y:int(y)-a,input().split()))\nw=2*n*(max(max(x),a))\ndp=[[0]*(w+1) for _ in range(n+1)]\ndp[0][w//2]=1\nfor i in range(1,n+1):\n  for j in range(w+1):\n    dp[i][j]=dp[i-1][j]+(dp[i-1][j-x[i-1]] if 0<=j-x[i-1]<=w else 0)\nprint(dp[n][w//2]-1)", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "n,a=list(map(int, input().split()))\nx=list(map(int, input().split()))\n\ndp=[[[0]*(2550) for _ in range(55)] for _ in range(55)]\ndp[0][0][0]=1\nfor i in range(n):\n    for j in range(n+1):\n        for sm in range(n*a+1):\n            if dp[i][j][sm]==0:\n                continue\n            dp[i+1][j][sm]+=dp[i][j][sm]\n            dp[i+1][j+1][sm+x[i]]+=dp[i][j][sm]\n\nans=0\nfor k in range(1,n+1):\n    ans+=dp[n][k][a*k]\nprint(ans)\n", "passed": true, "time": 0.43, "memory": 72300.0, "status": "done"}, {"code": "N,A=map(int,input().split())\nx=list(map(int,input().split()))\nx=[i-A for i in x]\ndp=[[0]*50*N*2 for i in range(N+1)]\ndp[0][50*N]=1\nfor i in range(1,N+1):\n    for j in range(50*N*2):\n        n=j-x[i-1]\n        if n>=0 and n<50*N*2:\n            dp[i][j]=dp[i-1][j]+dp[i-1][n]\n        else:\n            dp[i][j]=dp[i-1][j]\n    #else:\n        #print(dp[i])\n\nprint(dp[N][50*N]-1)", "passed": true, "time": 0.25, "memory": 14148.0, "status": "done"}, {"code": "N,A = map(int, input().split())\nalist = list(map(int, input().split()))\n\nblist = list(map(lambda x:x-A,alist))\nsum_plus = 0\nsum_minus = 0\nfor i in blist:\n    if i >0:\n        sum_plus +=i\n    else:\n        sum_minus +=i\n\nN=len(alist)\ndp = [[0 for i in range(sum_plus - sum_minus + 1)] for j in range(N+1)]\ndp[0][0-sum_minus]=1\n\nfor i in range(N):\n    for j in range(sum_plus - sum_minus+1):\n        if j-blist[i] <= (sum_plus - sum_minus):\n            dp[i+1][j]=dp[i][j-blist[i]]+dp[i][j]\n        else:\n            dp[i+1][j]=dp[i][j]\n\nprint(dp[N][0-sum_minus]-1)", "passed": true, "time": 0.23, "memory": 14316.0, "status": "done"}, {"code": "import sys\nreadline = sys.stdin.readline\n\ndef main():\n    N, A = map(int, readline().rstrip().split())\n    X = list(map(int, readline().rstrip().split()))\n    lim = max(X) * N\n    X = [x-A for x in X]\n    dp = [[0]*(2*lim) for _ in range(N+1)]\n    dp[0][lim] = 1\n    for i in range(1, N+1):\n        x = X[i-1]\n        for j in range(2*lim):\n            if 0 <= j - x < 2 * lim:\n                dp[i][j] = dp[i-1][j] + dp[i-1][j-x]\n            else:\n                dp[i][j] = dp[i-1][j]\n    \n    print(dp[N][lim] - 1)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.23, "memory": 14132.0, "status": "done"}, {"code": "import collections\nN, A = [int(_) for _ in input().split()]\nX = [int(_) for _ in input().split()]\n\n\ndef calc(W):\n    #dp[m][s]=m\u679a\u306e\u30ab\u30fc\u30c9\u306e\u548c\u304cs\u3068\u306a\u308b\u3088\u3046\u306a\u9078\u3073\u65b9\u306e\u7dcf\u6570\n    M = len(W)\n    dp = [collections.defaultdict(int) for _ in range(M + 1)]\n    dp[0][0] = 1\n    for i, w in enumerate(W):\n        for j in range(i, -1, -1):\n            for k, v in list(dp[j].items()):\n                dp[j + 1][k + w] += v\n    return dp\n\n\ndpx = calc(X)\nprint((sum(dpx[i][i * A] for i in range(1, N + 1))))\n", "passed": true, "time": 0.23, "memory": 14124.0, "status": "done"}, {"code": "n,a=list(map(int,input().split()))\nx=list(map(int,input().split()))\n\nfor i in range(n):\n    x[i]=x[i]-a\n    \nnx=n*n\ndp=[[0]*(2*nx+1) for i in range(n+1)]\n\n#print(dp)\n\ndp[0][nx]=1\n\nfor j in range(1,n+1):\n    jj=j-1\n    for t in range(2*nx+1):\n        if t-x[jj]<0 or 2*nx<t-x[jj]:\n            dp[j][t]=dp[j-1][t]\n        elif 0<t-x[jj] and  t-x[jj]<2*nx:\n            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]\n        else:\n            dp[j][t]=0\n\nprint((dp[n][nx]-1))\n        \n", "passed": true, "time": 0.17, "memory": 14248.0, "status": "done"}, {"code": "#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\ndef main():\n    N, A = map(int, input().split())\n    X = list(map(int, input().split()))\n    X = [x-A for x in X]\n\n    ret={0: 1}\n    for xi in X:\n        for y, cnt in list(ret.items()):\n            ret[xi+y] = ret.get(xi+y, 0) + cnt\n    print(ret[0]-1)\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, A, *X = list(map(int, read().split()))\n\n    X = [x - A for x in X]\n\n    base = 2500\n    dp = [[0] * 5001 for _ in range(N + 1)]\n    dp[0][base] = 1\n    for i in range(N):\n        for j in range(-2500, 2501):\n            if -2500 <= j - X[i] <= 2500:\n                dp[i + 1][j + base] = dp[i][j + base] + dp[i][j - X[i] + base]\n            else:\n                dp[i + 1][j + base] = dp[i][j + base]\n\n    print((dp[N][base] - 1))\n\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.86, "memory": 14356.0, "status": "done"}, {"code": "N,A = map(int,input().split())\nls1 = [0] + list(map(int,input().split()))\n\ndp = [[[0 for k in range(2600)] for j in range(51) ] for i in range(51)]\nfor i in range(51):\n    dp[i][0][0] = 1\nfor j in range(1,N+1):\n    for k in range(1,j+1):\n        for s in range(2600):\n            if s < ls1[j]:\n                dp[j][k][s] = dp[j-1][k][s]\n            elif s >= ls1[j]:\n                dp[j][k][s] = dp[j-1][k-1][s-ls1[j]] + dp[j-1][k][s]\nans = 0\nfor k in range(1,N+1):\n    ans += dp[N][k][k*A]\nprint(ans)", "passed": true, "time": 1.5, "memory": 70556.0, "status": "done"}, {"code": "n , a = list(map(int, input().split()))\nx = list(map(int,input().split()))\n\nx=[i-a for i in x]\ndp=[[0]*n*50*2 for i in range(n+1)]\n\ndp[0][n*50]=1\n\nfor i in range(n):\n    for j in range(n*50*2):\n        t=j-x[i]\n        if 0<=t<n*50*2:\n            dp[i+1][j]=dp[i][j]+dp[i][t]\n        else:\n            dp[i+1][j]=dp[i][j]\nprint((dp[n][n*50]-1))\n", "passed": true, "time": 0.29, "memory": 14364.0, "status": "done"}, {"code": "N, A = map(int,input().split())\nX = [int(x) for x in input().split()]\n\ndp = [[0]*(N*A+1) for _ in range(N+1)] #dp[i][j]:i\u679a\u306e\u548c\u304cj\u3068\u306a\u308b\u3088\u3046\u306a\u30ab\u30fc\u30c9\u306e\u9078\u3073\u65b9\ndp[0][0] = 1  \nfor x in X:\n    for i in reversed(range(1,N+1)):\n        for j in reversed(range(N*A+1)):\n            if j < x:\n                continue\n            dp[i][j] += dp[i-1][j-x]\nans = sum(dp[k][k*A] for k in range(1,N+1)) \nprint(ans) ", "passed": true, "time": 0.25, "memory": 14220.0, "status": "done"}, {"code": "N,A = list(map(int,input().split()))\nls1 = [0] + list(map(int,input().split()))\n\ndp = [[[0 for k in range(2600)] for j in range(51) ] for i in range(51)]\nfor i in range(51):\n    dp[i][0][0] = 1\nfor j in range(1,N+1):\n    for k in range(1,j+1):\n        for s in range(2600):\n            if s < ls1[j]:\n                dp[j][k][s] = dp[j-1][k][s]\n            elif s >= ls1[j]:\n                dp[j][k][s] = dp[j-1][k-1][s-ls1[j]] + dp[j-1][k][s]\nans = 0\nfor k in range(1,N+1):\n    ans += dp[N][k][k*A]\nprint(ans)\n", "passed": true, "time": 1.68, "memory": 70560.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nx = list(map(int, input().split()))\n\nfor i in range(n):\n  x[i] -= a\n\nd = [0] * 6000\nans = 0\nfor dif in x:\n  ans += d[-dif+3000]\n  if dif == 0:\n    ans += 1\n  if dif < 0:\n    for i in range(6000):\n      if 0 <= i+dif < 6000:\n        d[i+dif] += d[i]\n  else:\n    for i in range(5999, -1, -1):\n      if 0 <= i+dif < 6000:\n        d[i+dif] += d[i]\n  d[dif+3000] = d[dif+3000] + 1\n  \nprint(ans)", "passed": true, "time": 0.25, "memory": 14124.0, "status": "done"}, {"code": "n,a=map(int,input().split())\nfrom collections import Counter\nX = [int(x) - a for x in input().split()]\nd=Counter([0])\nfor i in X:\n    tmp=Counter()\n    for j,k in d.items():\n        tmp[i+j]+=k\n    d+=tmp\nprint(d[0]-1)", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "#\u60f3\u5b9a\u89e3\u6cd5\nN, A = list(map(int, input().split()))\nX = sorted(list(map(int, input().split())))\nxm = max(X)\nxm = max(xm, A)\nfor i in range(N):\n  X[i] -= A \n#print(X, xm)\ndp = [[0] * (2 * N * xm + 1) for i in range(N + 1)]\ndp[0][N * xm] = 1\n\nfor i in range(1, N + 1):\n  for j in range(2 * N * xm + 1):\n    if 0 <= j - X[i - 1] <= 2 * N * xm:\n      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - X[i - 1]]\n    else:\n      dp[i][j] = dp[i - 1][j]\n\nprint((dp[N][N * xm] - 1))\n", "passed": true, "time": 0.23, "memory": 14312.0, "status": "done"}, {"code": "f=lambda:map(int,input().split())\nn,a=f()\nl=[i-a for i in f()]\ndp=[[0]*5000 for _ in range(51)]\nZ=2500\ndp[0][Z]=1\nfor i in range(n):\n  for s in range(5000-max(l[i],0)):\n    dp[i+1][s]+=dp[i][s]\n    dp[i+1][s+l[i]]+=dp[i][s]\nprint(dp[n][Z]-1)", "passed": true, "time": 0.36, "memory": 14228.0, "status": "done"}, {"code": "n,a=map(int,input().split())\nX=list(map(int,input().split()))\ndp=[[0]*2501 for _ in range(n+1)]\ndp[0][0]=1\nfor i in range(n):\n    x=X[i]\n    for j in range(n,0,-1):\n    \tfor k in range(2501-x):\n        \tdp[j][k+x]+=dp[j-1][k]\nans=0\nfor i in range(n):\n    ans+=dp[i+1][(i+1)*a]\nprint(ans)", "passed": true, "time": 0.51, "memory": 14348.0, "status": "done"}, {"code": "N, A = map(int, input().split())\nX = list(map(int, input().split()))\ndp = [[[0] * 6000 for _ in range(N + 1) ] for _ in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n    for j in range(N):\n        for k in range(5000):\n            if dp[i][j][k] == 0:\n                continue\n            dp[i + 1][j][k] += dp[i][j][k]\n            dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]\nC = 0\nfor i in range(N + 1):\n    C += dp[N][i][i * A]\nprint(C - 1)", "passed": true, "time": 0.58, "memory": 66404.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, A, *X = list(map(int, read().split()))\n\n    X = [x - A for x in X]\n\n    neg = pos = 0\n    for x in X:\n        if x > 0:\n            pos += x\n        else:\n            neg += x\n\n    M = pos - neg\n    base = -neg\n\n    dp = [[0] * (M + 1) for _ in range(N + 1)]\n    dp[0][base] = 1\n\n    for i in range(N):\n        for s in range(M + 1):\n            dp[i + 1][s] = dp[i][s]\n            if 0 <= s - X[i] <= M:\n                dp[i + 1][s] += dp[i][s - X[i]]\n\n    print((dp[N][base] - 1))\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "N, A = map(int, input().split())\nX = list(map(int, input().split()))\nsumX = 2501\n\ndp = [[[0 for _ in range(sumX)] for _ in range(N+1)] for _ in range(N+1)]\ndp[0][0][0] = 1\n\nfor j in range(N):\n    for k in range(N):\n        for s in range(sumX):\n            if dp[j][k][s]==0:\n                continue\n            dp[j+1][k][s] += dp[j][k][s]\n            dp[j+1][k+1][s+X[j]] += dp[j][k][s]\nans = 0\n\nfor i in range(N+1):\n    ans += dp[N][i][i*A]\nprint(ans-1)", "passed": true, "time": 0.42, "memory": 34852.0, "status": "done"}, {"code": "\nNMAX = 55\nT = 2500\nN, A = list(map(int, input().split()))\nX = list([int(x) - A for x in input().split()])\n\ndp = [[0]*5001 for i in range(NMAX)]  # i\u6642\u70b9\u3067\u7dcf\u548c\u304cS\u306b\u306a\u308b\u3082\u306e\u306e\u500b\u6570\n\ndp[0][T] = 1\n\nfor i in range(N):\n    for s in range(5001):\n        if s+X[i] > 5001 or dp[i][s] == 0:\n            continue\n        dp[i+1][s] += dp[i][s]\n        dp[i+1][s+X[i]] += dp[i][s]\n\nprint((dp[N][T]-1))\n\n", "passed": true, "time": 0.17, "memory": 14224.0, "status": "done"}, {"code": "n,a=map(int,input().split())\nA=list(map(int,input().split()))\nfor i in range(n):\n  A[i]=A[i]-a\nB=[]\nc=0\nfor i in range(n):\n  if A[i]==0:\n    c=c+1\n  else:\n    B.append(A[i])\nn=len(B)\ndp=[[0]*5010 for i in range(n+1)]#0\u30682505\u3092\u5bfe\u5fdc\nfor i in range(1,n+1):\n  dp[i]=dp[i-1][0:5010]\n  dp[i][2505+B[i-1]]+=1\n  for j in range(5010):\n    if 0<=j+B[i-1] and j+B[i-1]<=5009:\n      dp[i][j+B[i-1]]+=dp[i-1][j]\nans=dp[n][2505]\nprint((ans+1)*2**c-1)", "passed": true, "time": 0.16, "memory": 14300.0, "status": "done"}, {"code": "\nNMAX = 55\n\nN, A = list(map(int, input().split()))\nX = list(map(int, input().split()))\n\ndp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]\n\ndp[0][0][0] = 1 # dp[i][s][k]: i\u500b\u304b\u3089k\u500b\u9078\u3076\u3068\u304d\u3001\u7dcf\u548c\u304cs\u306e\u3082\u306e\u306e\u500b\u6570\nfor i in range(N): # N-1\u6642\u70b9\u3067N\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u3067\u3053\u3053\u307e\u3067\u3067\u5341\u5206\n    for s in range(3000):\n        for k in range(N+1):\n            if dp[i][s][k] == 0:\n                continue\n            dp[i+1][s][k] += dp[i][s][k]\n            dp[i+1][s+X[i]][k+1] += dp[i][s][k]\n\nans = 0\nfor k in range(1, N+1):\n    ans += dp[N][A*k][k]\n\nprint(ans)\n", "passed": true, "time": 1.02, "memory": 97168.0, "status": "done"}, {"code": "n,a = map(int,input().split())\nx = list(map(int,input().split()))\nt = [[[0] * (50*(j+1)+1) for j in range(i+2)] for i in range(n+1)]\nans = 0\nt[0][0][0] = 1\n\nfor i in range(1, n+1):\n    for j in range(i+1):\n        for k in range(50*j + 1):\n            if j >= 1 and k >= x[i-1]:\n                t[i][j][k] = t[i - 1][j - 1][k - x[i-1]] + t[i - 1][j][k]\n            else:\n                t[i][j][k] = t[i - 1][j][k]\nfor i in range(1,n+1):\n    ans += t[n][i][i*a]\nprint(ans)", "passed": true, "time": 0.23, "memory": 14608.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\nimport sys\n# import math\n# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits\n# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from operator import itemgetter              # itemgetter(1), itemgetter('key')\n# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()\n# from collections import defaultdict          # subclass of dict. defaultdict(facroty)\n# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)\n# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).\n# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).\n# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])\n# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]\n# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]\n# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])\n# from itertools import combinations, combinations_with_replacement\n# from itertools import accumulate             # accumulate(iter[, f])\n# from functools import reduce                 # reduce(f, iter[, init])\n# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)\n# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).\n# from copy import deepcopy                    # to copy multi-dimentional matrix without reference\n# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)\n\n\ndef main():\n    mod = 1000000007                # 10^9+7\n    inf = float('inf')              # sys.float_info.max = 1.79...e+308\n    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19\n    sys.setrecursionlimit(10**6)    # 1000 -> 1000000\n    def input(): return sys.stdin.readline().rstrip()\n    def ii():    return int(input())\n    def mi():    return list(map(int, input().split()))\n    def mi_0():  return [int(x)-1 for x in input().split()]\n    def lmi():   return list(map(int, input().split()))\n    def lmi_0(): return list([int(x)-1 for x in input().split()])\n    def li():    return list(input())\n    \n    \n    n, a = mi()\n    L = lmi()\n    diff = [elm - a for elm in L]\n    # dp[i][num] = (diff \u304b\u3089 i \u756a\u76ee\u307e\u3067\u3092\u4f7f\u7528\u3057\u3066\u548c\u3092 num - 2500 \u306b\u3059\u308b\u5834\u5408\u306e\u6570)\n    dp = [[0] * 5001 for _ in range(n + 1)]\n    dp[0][2500] = 1\n\n    for i in range(n):\n        for j in range(5001):\n            if dp[i][j]:\n                dp[i+1][j + diff[i]] += dp[i][j]\n            dp[i+1][j] += dp[i][j]\n    \n\n    print((dp[n][2500] - 1))    # n \u756a\u76ee\u307e\u3067\u3092\u4f7f\u7528\u3057\u3066\u548c\u3092 0 \u306b\u3059\u308b\u306b\u306f\uff1f \u6700\u521d\u306e\u4f55\u3082\u9078\u3070\u306a\u3044 1 \u901a\u308a\u3092\u9664\u304f\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.19, "memory": 14316.0, "status": "done"}, {"code": "def main():\n    N, A = list(map(int, input().split()))\n    X = list(map(int, input().split()))\n\n    dp = [[0] * (A * N + 1) for _ in range(N + 1)]\n    dp[0][0] = 1\n    for i, x in enumerate(X):\n        for j in reversed(list(range(1, i + 2))):\n            for a in range(x, A * N + 1):\n                dp[j][a] += dp[j - 1][a - x]\n    return sum(dp[i][A * i] for i in range(1, N + 1))\n\nprint((main()))\n", "passed": true, "time": 0.24, "memory": 14384.0, "status": "done"}, {"code": "import sys\nfrom collections import defaultdict\n\nn, a, *x = map(int, sys.stdin.read().split())\nfor i in range(n): x[i] -= a\n\ndef main():\n  dp = defaultdict(int); dp[0] = 1\n  for i in range(n):\n    ndp = dp.copy()\n    for k, v in dp.items():\n      ndp[k+x[i]] += v\n    dp = ndp\n  print(dp[0] - 1)\n  \ndef __starting_point():\n  main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "N,A = map(int,input().split())\nX = list(map(int,input().split()))\nY = [x-A for x in X]\ndp = {0:1}\n\nfor y in Y:\n  tmp = list(dp.items())\n  for k,v in tmp:\n    dp[k+y]=dp.get(k+y,0)+v\n\nprint(dp[0]-1)", "passed": true, "time": 0.23, "memory": 14228.0, "status": "done"}, {"code": "N, A = map(int, input().split())\nx = list(map(int, input().split()))\nmaxX = max(max(x), A)\ndp = [[[0 for _ in range(N * maxX + 1)] for _ in range(N + 1)] for _ in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n    for j in range(N + 1):\n        for k in range(N * A + 1):\n            if dp[i][j][k] == 0: continue\n            dp[i + 1][j][k] += dp[i][j][k]\n            dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]\n\nans = 0\nfor i in range(1, N + 1):\n    ans += dp[N][i][A * i]\nprint(ans)", "passed": true, "time": 0.16, "memory": 14128.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nl = list(map(int, input().split()))\nans = 0\ndp = list([0]*(n*a+1) for _ in range(n+1))#\u52d5\u7684\u8a08\u753b\u6cd5\u3067\u89e3\u304f\ndp[0][0] = 1\nfor x in l:\n    for i in range(n, 0, -1):#\u4e0b\u884c\u304b\u3089\u9806\u306b\u683c\u7d0d\u3057\u3066\u3044\u304f(\u4e0a\u304b\u3089\u3060\u3068\u683c\u7d0d\u3057\u305f\u3070\u304b\u308a\u306e\u5024\u304c\u53c2\u7167\u3055\u308c\u3066\u3057\u307e\u3046)\n        for j in range(n*a+1):\n            if x > j:\n                continue\n            dp[i][j] += dp[i-1][j-x]\n\nfor i in range(n):\n    ans += dp[i+1][(i+1)*a]\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14340.0, "status": "done"}, {"code": "from collections import Counter\n\n\nN, A = list(map(int, input().split()))\nX = list(map(int, input().split()))\nY = [x - A for x in X]\nL = Counter()\nL[0] = 1\n\nfor y in Y:\n    for key, value in list(L.items()):\n        L[key + y] += value\n\nprint((L[0] - 1))\n", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "n,a=map(int,input().split())\nx=list(map(int,input().split()))\ndp=[[0]*(n*a+1) for i in range(n+1)]\ndp[0][0]=1\nans=0\nfor i in x:\n    for j in range(n,0,-1):\n        for k in range(n*a,i-1,-1):\n            dp[j][k]+=dp[j-1][k-i]\nfor i in range(1,n+1):\n    ans+=dp[i][i*a]\nprint(ans)", "passed": true, "time": 0.17, "memory": 14144.0, "status": "done"}, {"code": "def resolve():\n    N, A = list(map(int, input().split()))\n    X = [int(i) - A for i in input().split()]\n    d = {0: 1}\n    for x in X:\n        for _sum, count in list(d.items()):\n            d[_sum+x] = d.get(_sum+x, 0) + count\n\n    print((d[0]-1))\n    \n\n\nif '__main__' == __name__:\n    resolve()\n\n", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "n,a=list(map(int,input().split()))\nx=list(map(int,input().split()))\nfor i in range(n):\n    x[i]-=a\n# dp[i][j] = i\u756a\u76ee\u307e\u3067\u3067(j-2500)\u3092\u4f55\u500b\u4f5c\u308c\u308b\u304b\ndp=[[0]*5001 for i in range(n+1)]\ndp[0][2500]=1\nfor i in range(n):\n    for j in range(5000):\n        for k in range(2):\n            if 0<=j-k*x[i]<=5000:\n                dp[i+1][j]+=dp[i][j-k*x[i]]\nprint((dp[n][2500]-1))\n", "passed": true, "time": 0.3, "memory": 14280.0, "status": "done"}, {"code": "n,a=list(map(int,input().split()))\nx=list(map(int,input().split()))\nfor i in range(n):\n    x[i]-=a\n# dp[i][j] = i\u756a\u76ee\u307e\u3067\u3067(j-2500)\u3092\u4f55\u500b\u4f5c\u308c\u308b\u304b\ndp=[[0]*5001 for i in range(n)]\ndp[0][x[0]+2500]=1\nfor i in range(1,n):\n    dp[i][x[i]+2500]=1\n    for j in range(5000):\n        for k in range(2):\n            if 0<=j-k*x[i]<=5000:\n                dp[i][j]+=dp[i-1][j-k*x[i]]\nprint((dp[n-1][2500]))\n", "passed": true, "time": 0.31, "memory": 14372.0, "status": "done"}, {"code": "def main():\n    N, A = list(map(int, input().split()))\n    x = list(map(int, input().split()))\n    dp = [[0] * (50*N + 1) for _ in range(N+1)]\n    dp[0][0] = 1\n    for k in range(N):\n        for i in reversed(list(range(k+1))):\n            for j in range(50 * N + 1 -x[k]):\n                dp[i+1][j+x[k]] += dp[i][j]\n    r = 0\n    for i in range(1, N+1):\n        r += dp[i][i*A]\n    return r\nprint((main()))\n", "passed": true, "time": 0.26, "memory": 14296.0, "status": "done"}, {"code": "N, A = map(int, input().split())\nx = list(map(int, input().split()))\nmaxX = max(max(x), A)\ndp = [[[0 for _ in range(N * maxX + 1)] for _ in range(N + 1)] for _ in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n    for j in range(N + 1):\n        for k in range(N * A + 1):\n            if dp[i][j][k] == 0: continue\n            dp[i + 1][j][k] += dp[i][j][k]\n            dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]\n\nans = 0\nfor i in range(1, N + 1):\n    ans += dp[N][i][A * i]\nprint(ans)", "passed": true, "time": 0.15, "memory": 14228.0, "status": "done"}, {"code": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return list(map(int, input().split()))\ndef LIST(): return list(map(int, input().split()))\ndef TUPLE(): return tuple(map(int, input().split()))\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\nsys.setrecursionlimit(10 ** 9)\nINF = 10**6#float('inf')\nmod = 10 ** 9 + 7 \n#mod = 998244353\n#from decimal import *\n#import numpy as np\n#decimal.getcontext().prec = 10\n\nN, A = MAP()\nx = LIST()\n\nbig = []\nsmall = []\ncnt = 0\n\nfor y in x:\n\tif y == A:\n\t\tcnt += 1\n\telif y < A:\n\t\tsmall.append(A-y)\n\telse:\n\t\tbig.append(y-A)\n\nbig_possible = [0]*2501\nsmall_possible = [0]*2501\nbig_possible[0] = 1\nsmall_possible[0] = 1\n\nfor a in big:\n\tfor i in range(2500-a, -1, -1):\n\t\tif big_possible[i]:\n\t\t\tbig_possible[i+a] += big_possible[i]\n\nfor b in small:\n\tfor i in range(2500-b, -1, -1):\n\t\tif small_possible[i]:\n\t\t\tsmall_possible[i+b] += small_possible[i]\n\nans = 1\nfor i in range(1, 2501):\n\tans += small_possible[i]*big_possible[i]\n\n\nans *= 2**cnt\nprint((ans-1))\n", "passed": true, "time": 0.15, "memory": 14464.0, "status": "done"}, {"code": "n,a = map(int, input().split())\nX = list(map(int, input().split()))\nx = [i-a for i in X]\ndp = [[0]*5201 for i in range(n+1)]\ndp[0][2600] = 1 \nfor i,xi in enumerate(x):\n  for k in range(99,5101):\n    dp[i+1][k+xi] += dp[i][k] \n    dp[i+1][k] += dp[i][k]\nans = dp[n][2600] - 1\nprint(ans)", "passed": true, "time": 0.19, "memory": 14260.0, "status": "done"}, {"code": "N,A = map(int,input().split())\nY = list(map(lambda x:int(x)-A,input().split()))\ndp = {0:1}\n\nfor y in Y:\n\tfor k,v in list(dp.items()):\n\t\tdp[k+y]=dp.get(k+y,0)+v\n\nprint(dp[0]-1)", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "N,A = list(map(int,input().split()))\nY = list([int(x)-A for x in input().split()])\ndp = {0:1}\n\nfor y in Y:\n\tfor k,v in list(dp.items()):\n\t\tdp[k+y]=dp.get(k+y,0)+v\n\nprint((dp[0]-1))\n", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nxlst = list(map(int, input().split()))\ndp = [[0 for _ in range(5001)] for _ in range(n + 1)]\ncenter = 2500\ndp[0][center] = 1\nfor i, x in enumerate(xlst, 1):\n    num = x - a\n    for j in range(5001):\n        dp[i][j] = dp[i - 1][j]\n        if 0 <= j - num <= 5000:\n            dp[i][j] += dp[i - 1][j - num]\nprint(dp[-1][center] - 1)", "passed": true, "time": 0.2, "memory": 14096.0, "status": "done"}, {"code": "from collections import defaultdict\nn, a = map(int, input().split())\nx = list(map(int, input().split()))\nx.sort()\nx = list(map(lambda x:x - a, x))\ndic = defaultdict(int)\ndic[0] = 1\nfor i in x:\n    for j, k in list(dic.items()):\n        dic[j + i] = dic.get(j + i, 0) + k\nprint(dic[0] - 1)", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "from collections import defaultdict\n\nN, A = map(int, input().split())\nX = list(map(int, input().split()))\nX =[x - A for x in X]\n\nd = defaultdict(int)\nd[0] = 1\n\nfor x in X:\n  for k, v in list(d.items()):\n    d[k+x] += v\n\nprint(d[0]-1)", "passed": true, "time": 0.15, "memory": 14224.0, "status": "done"}, {"code": "n, a = map(int, input().split())\nx = [int(x) for x in input().split()]\n\ndp = [[0]*2501 for _ in range(n+1)]\nfor i in range(n+1):\n  for j in range(i-1, -1, -1):\n    if j == 0:\n      dp[j+1][x[i-1]] += 1\n    for k in range(2500, -1, -1):\n      if dp[j][k] and k+x[i-1] <= 2500:\n        dp[j+1][k+x[i-1]] += dp[j][k]\n\nans = 0\nfor i in range(1, n+1):\n  ans += dp[i][i*a]\nprint(ans)", "passed": true, "time": 0.2, "memory": 14240.0, "status": "done"}, {"code": "n, a = list(map(int, input().split()))\nx = list(map(int, input().split()))\nMAX = 50 * n\n\ndp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]\ndp[0][0][0] = 1\n\nfor i, e in enumerate(x, 1):\n    for j in range(i):\n        for k in range(MAX + 1):\n            dp[i][j][k] += dp[i-1][j][k]\n\n    for j in range(i):\n        for k in range(MAX - e + 1):\n            dp[i][j+1][k+e] += dp[i-1][j][k]\n\nans = 0\nfor cnt in range(1, n + 1):\n    sm = cnt * a\n    ans += dp[n][cnt][sm]\n\nprint(ans)\n", "passed": true, "time": 0.41, "memory": 26616.0, "status": "done"}, {"code": "N,A = (int(T) for T in input().split())\nX = [int(T)-A for T in input().split()]\nDP = [[0]*(2*(50*N)+1) for TI in range(0,N+1)]\nDP[0][50*N] = 1\nfor TI in range(0,N):\n    for TS in range(0,2*50*N+1):\n        if DP[TI][TS]!=0:\n            DP[TI+1][TS] += DP[TI][TS]\n            DP[TI+1][TS+X[TI]] += DP[TI][TS]\nprint(DP[N][50*N]-1)", "passed": true, "time": 0.29, "memory": 14132.0, "status": "done"}, {"code": "n, a = list(map(int, input().split()))\nX = tuple(map(int, input().split()))\ndp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]\ndp[0][0][0] = 1\nfor i in range(n):\n    # i\u679a\u76ee\u307e\u3067\u3067\n    for j in range(n):\n        # j\u679a\u306e\u30ab\u30fc\u30c9\u3092\u9078\u3093\u3067\n        for s in range(n*a+1):\n            # \u5408\u8a08\u304cs\u306b\u306a\u308b\u30d1\u30bf\u30fc\u30f3\n            if dp[i][j][s] == 0:\n                continue\n            # i\u679a\u76ee\u306e\u30ab\u30fc\u30c9\u304c\u9078\u3070\u308c\u306a\u3044\u5834\u5408\n            dp[i+1][j][s] += dp[i][j][s]\n            # i\u679a\u76ee\u306e\u30ab\u30fc\u30c9\u304c\u9078\u3070\u308c\u308b\u5834\u5408\n            dp[i+1][j+1][s+X[i]] += dp[i][j][s]\nans = 0\nfor k in range(1, n+1):\n    ans += dp[n][k][k*a]\nprint(ans)\n", "passed": true, "time": 0.16, "memory": 34684.0, "status": "done"}, {"code": "N, A = list(map(int, input().split()))\nlst = [int(x) - A for x in input().split()]\ndp = [[0] * (100 * N + 1) for _ in range(N + 1)]\ndp[0][50 * N] = 1\nfor i in range(N):\n    for j in range(50, 100 * N + 1 - 50):\n        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]\nprint((dp[N][50 * N] - 1))\n", "passed": true, "time": 0.15, "memory": 14216.0, "status": "done"}, {"code": "N,A=map(int,input().split())\nx=list(map(int,input().split()))\ndp=[[[0]*(2501) for i in range(N+1)] for k in range(N+1)]\ndp[0][0][0]=1\nfor j in range(N):\n  for k in range(N):\n    for i in range(2501):\n      if dp[j][k][i]==0:\n        continue\n      dp[j+1][k][i]+=dp[j][k][i]\n      dp[j+1][k+1][i+x[j]]+=dp[j][k][i]\nans=0\nfor j in range(N+1):\n    ans+=dp[N][j][j*A]\nprint(ans-1)", "passed": true, "time": 0.34, "memory": 34384.0, "status": "done"}]