Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n+1):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n+1):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n+1):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans > tmpx
                ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n):
    tmpx = x + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    p = input()
    ans = x
else:
    p = list(map(int, input().split()))

d = float('inf')

for i in range(n):
    tmpx = x + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    ans = x
else:
    p = list(map(int, input().split()))

d = float('inf')

for i in range(n):
    tmpx = x + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            ans = tmpx

print(ans)




Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)