Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[[0 for k in range(x_sum + 1)] for j in range(n + 1)] for i in range(2)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        idx = i % 2
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[idx][j][k] = dp[1 - idx][j][k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[idx][j][k] = dp[1 - idx][j][k] + dp[1 - idx][j - 1][k - x[i - 1]]

    for j in range(1, min(x_sum // a + 1, n + 1)):
        ans += dp[idx][j][j * a]
print(ans)


Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)

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

n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
if x_max < a:
    print(0)
else:
    dp = np.zeros([n + 1, n + 1, x_sum + 1], dtype=int)
    dp[0, 0, 0] = 1
    for i in range(1, n + 1):
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[i, j, k] = dp[i - 1, j, k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[i, j, k] = dp[i - 1, j, k] + dp[i - 1, j - 1, k - x[i - 1]]

    ans = 0
    for j in range(1, min(x_sum // a + 1, n + 1)):
        ans += dp[-1, j, j * a]
    print(ans)


Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
if x_max < a:
    print(0)
else:
    dp = [[[0 for k in range(x_sum + 1)] for j in range(n + 1)] for i in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[i][j][k] = dp[i - 1][j][k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]]

    ans = 0
    for j in range(1, min(x_sum // a + 1, n + 1)):
        ans += dp[-1][j][j * a]
    print(ans)


Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
if x_max < a:
    print(0)
else:
    dp = [[[0 for k in range(x_sum + 1)] for j in range(n + 1)] for i in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[i][j][k] = dp[i - 1][j][k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]]

    ans = 0
    for j in range(1, n + 1):
        ans += dp[-1][j][j * a]
    print(ans)


Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0 for k in range(n * x_max + 1)] for j in range(n + 1)] for i in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
    for j in range(n + 1):
        for k in range(x[i - 1]):
            dp[i][j][k] = dp[i - 1][j][k]
        if j > 0:
            for k in range(x[i - 1], n * x_max + 1):
                dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]]
ans = 0
for j in range(1, n + 1):
    ans += dp[-1][j][j * a]
print(ans)


Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)