Buggy python submission (verdict: Runtime Error):
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(55) for _ in range(55)] for _ in range(3000)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(N*A):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)


Fixed submission:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(3000) for _ in range(55)] for _ in range(55)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(2900):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)

Buggy python submission (verdict: Runtime Error):
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(55) for _ in range(55)] for _ in range(3000)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(sum+2):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)


Fixed submission:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(3000) for _ in range(55)] for _ in range(55)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(2900):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)