Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p = list(map(int, input().split()))

p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p = list(map(int, input().split()))

p.sort()

for i in range(len(p)):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Buggy python submission (verdict: Runtime Error):
import sys
import math

x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p_list = list(map(int, input().split()))

p_list.sort()

if p_list[-1] < x:
    print(x)
    sys.exit()
elif p_list[-1] == x:
    if p_list[-2] == x-1:
        print(x +1)
    else:
        print(x -1)
    sys.exit()

for i in range(n):
    if p_list[i] == x:
        j = i
        k = 1
        while j <= n-1:
            if p_list[i-k] != x-k and i != 0:
                print(x-k)
                sys.exit()
            elif p_list[i+k] != x+k and i != n-1:
                print(x+k)
                sys.exit()
            
            if p_list[i+k] == p_list[-1]:
                break
            elif p_list[i-k] == p_list[0]:
                break
            j += 1
            k += 1
            
    if p_list[i] > x:
        print(x)
        sys.exit()


#sub = min(abs(p_list[j] - x), abs(p_list[j-1] -x))

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Buggy python submission (verdict: Runtime Error):
import sys
import math

x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p_list = list(map(int, input().split()))

p_list.sort()

for i in range(n):
    if p_list[i] == x:
        j = i
        k = 1
        while j <= n-1:
            if p_list[i-k] != x-k and i != 0:
                print(x-k)
                sys.exit()
            elif p_list[i+k] != x+k and i != n-1:
                print(x+k)
                sys.exit()
            j += 1
            k += 1
    if p_list[i] > x:
        print(x)
        sys.exit()

if p_list[-1] < x:
    print(x)


#sub = min(abs(p_list[j] - x), abs(p_list[j-1] -x))

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()

Buggy python submission (verdict: Runtime Error):
import sys
import math

x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()

p_list = list(map(int, input().split()))

p_list.sort()

for i in range(n):
    if p_list[i] == x:
        j = i
        k = 1
        while j <= n-1:
            if p_list[i-k] != x-k and i != 0:
                print(x-k)
                sys.exit()
            elif p_list[i+k] != x+k and i != n-1:
                print(x+k)
                sys.exit()
            j += 1
            k += 1
    if p_list[i] > x:
        print(x)
        break


#sub = min(abs(p_list[j] - x), abs(p_list[j-1] -x))

Fixed submission:
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

#p.sort()

for i in range(101):
    if x -i not in p:
        print(x-i)
        exit()
    elif x +i not in p:
        print(x+i)
        exit()