Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())

tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))

if M == 1:
    if K == 0:
        print("0 0 1 1")
    else:
        print(-1)
elif 2**M > K:
    ans = X + [K] + X[::-1] + [K]
    print(*ans)
else:
    print(-1)


Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())
try:
    assert M <= 17
except:
    print(-1)
    exit()
tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())

tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())

tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    ans = X + [K] + X[::-1] + [K]
    print(*ans)
else:
    print(-1)


Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())

tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))
for i in X:
    tmp ^= i

if tmp == K:
    ans = X + [K] + X[::-1] + [K]
    print(*ans)
elif K == 0:
    ans = []
    for i in range(2**M):
        ans += [i]*2
    print(*ans)
else:
    print(-1)

Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
M, K = map(int, input().split())

tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))
for i in X:
    tmp ^= i

if tmp == K:
    ans = X + [K] + X[::-1] + [K]
    print(*ans)
elif K == 0:
    ans = []
    for i in range(2**M):
        ans += [i]*2
    print(*ans)
else:
    print(-1)

Fixed submission:
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)