Buggy python submission (verdict: Time Limit Exceeded):
x, n = map(int, input().split())
p = list(map(int, input().split()))
 

_x = x 
x_ = x
while True:
  if _x not in p:
    print(_x)
    break
    if x_ not in p:
      print(x_)
      break
      _x -= 1
      x_ += 1

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
x, n = map(int, input().split())
p = list(map(int, input().split()))

_x = x 
x_ = x
while True:
  if _x not in p:
    print(_x)
    break
    if x_ not in p:
      print(x_)
      break
      _x -= 1
      x_ += 1

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

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

if n == 0:
    print(x)

p = set(p)
else:
    _x = x 
    x_ = x
    while True:
        _x -= 1
        x_ += 1
        if _x not in p:
            print(_x)
            break
        if x_ not in p:
            print(x_)
            break

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

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

if n == 0:
    print(x)
else:
    q = []
    r = []
    min_ = 1000
    for i in range(1, 101):
        if not i in p:
            q.append(i)

    for j in q:
        k = int(abs(x - j))
        if min_ == k:
            r.append(before_j)
            r.append(j)
        min_ = min(k, min_)
        if min_ == k:
            before_j = j

    print(min(r))

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

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

q = []
r = []
min_ = 1000
for i in range(1, 101):
    if not i in p:
        q.append(i)
        
for j in q:
    k = int(abs(x - j))
    if min_ == k:
        r.append(before_j)
        r.append(j)
    min_ = min(k, min_)
    if min_ == k:
        before_j = j

print(min(r))

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

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

q = []
r = []
min_ = 1000
for i in range(1, 101):
    if not i in p:
        q.append(i)
        
for j in q:
    k = int(abs(x - j))
    if min_ == k:
        r.append(before_j)
        r.append(j)
    min_ = min(k, min_)
    if min_ == k:
        before_j = j

print(min(r))

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break