Buggy python submission (verdict: Runtime Error):
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    x = [i - A for i in X]
    nx = max(x) * N
    dp = [[0] * (2 * nx + 1) for _ in [0] * (N + 1)]
    for i in range(N + 1):
        for j in range(2 * nx + 1):
            if not i:
                if j == nx:
                    dp[i][j] = 1
            elif j - x[i-1] < 0 or j - x[i-1] > 2 * nx:
                dp[i][j] = dp[i-1][j]
            elif 0 <= j - x[i-1] <= 2 * nx:
                dp[i][j] = dp[i-1][j] + dp[i-1][j - x[i-1]]
    print(dp[N][nx] - 1)

main()


Fixed submission:
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    x = [i - A for i in X]
    nx = max(X) * N
    dp = [[0] * (2 * nx + 1) for _ in [0] * (N + 1)]
    for i in range(N + 1):
        for j in range(2 * nx + 1):
            if not i:
                if j == nx:
                    dp[i][j] = 1
            elif j - x[i-1] < 0 or j - x[i-1] > 2 * nx:
                dp[i][j] = dp[i-1][j]
            elif 0 <= j - x[i-1] <= 2 * nx:
                dp[i][j] = dp[i-1][j] + dp[i-1][j - x[i-1]]
    print(dp[N][nx] - 1)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    nx = max(A, max(X)) * N
    dp = np.array([[[0] * (nx + 1) for _ in [0] * (N + 1)] for _ in [0] * (N + 1)])

    for i in range(N + 1):
        for j in range(N + 1):
            for k in range(nx + 1):
                if j == 0 and k == 0:
                    dp[i][j][k] = 1
                elif i >= 1 and k < X[i-1]:
                    dp[i][j][k] = dp[i-1][j][k]
                elif i >= 1 and j >= 1 and k >= X[i-1]:
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

    ans = 0
    for k in range(1, N + 1):
        ans += dp[N][k][k*A]
    print(ans)

main()


Fixed submission:
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    x = [i - A for i in X]
    nx = max(X) * N
    dp = [[0] * (2 * nx + 1) for _ in [0] * (N + 1)]
    for i in range(N + 1):
        for j in range(2 * nx + 1):
            if not i:
                if j == nx:
                    dp[i][j] = 1
            elif j - x[i-1] < 0 or j - x[i-1] > 2 * nx:
                dp[i][j] = dp[i-1][j]
            elif 0 <= j - x[i-1] <= 2 * nx:
                dp[i][j] = dp[i-1][j] + dp[i-1][j - x[i-1]]
    print(dp[N][nx] - 1)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    nx = max(A, max(X)) * N
    dp = [[[0 for _ in [0] * (nx + 1)] for _ in [0] * (N + 1)] for _ in [0] * (N + 1)]

    for i in range(N + 1):
        for j in range(N + 1):
            for k in range(nx + 1):
                if j == 0 and k == 0:
                    dp[i][j][k] = 1
                elif i >= 1 and k < X[i-1]:
                    dp[i][j][k] = dp[i-1][j][k]
                elif i >= 1 and j >= 1 and k >= X[i-1]:
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

    ans = 0
    for k in range(1, N + 1):
        ans += dp[N][k][k*A]
    print(ans)

main()


Fixed submission:
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    x = [i - A for i in X]
    nx = max(X) * N
    dp = [[0] * (2 * nx + 1) for _ in [0] * (N + 1)]
    for i in range(N + 1):
        for j in range(2 * nx + 1):
            if not i:
                if j == nx:
                    dp[i][j] = 1
            elif j - x[i-1] < 0 or j - x[i-1] > 2 * nx:
                dp[i][j] = dp[i-1][j]
            elif 0 <= j - x[i-1] <= 2 * nx:
                dp[i][j] = dp[i-1][j] + dp[i-1][j - x[i-1]]
    print(dp[N][nx] - 1)

main()