Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
p=0
if x==0:
  print(n)
elif n not in l:
  print(n)
else:
  for i in range(101):
    if abs(x-i)>abs(x-p) and i not in p:
      p=i
  print(p)

Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)

Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
if n == 0:
    print(0)
else:
    l = list(map(int, input().split()))
    l.sort()
    k1 = [i for i in range(min(l), max(l) + 1) if i not in l]
    d = {}
    for i in range(len(k1)):
        d[k1[i]] =max(k1[i],k)-min(k1[i],k)
    k2 = min(d, key=d.get)
    if len(d)==0 or len(k1)<=1:
        print(0)
    else:
        print(k2)

Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)

Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
if n == 0:
    print(0)
else:
    l = list(map(int, input().split()))
    l.sort()
    k1 = [i for i in range(min(l), max(l) + 1) if i not in l]
    d = {}
    for i in range(len(k1)):
        d[k1[i]] =max(k1[i],k)-min(k1[i],k)
    k2 = min(d, key=d.get)
    if len(d)==0 or len(k1)==0:
        print(0)
    else:
        print(k2)

Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)

Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
if n == 0:
    print(0)
else:
    l = list(map(int, input().split()))
    l.sort()
    k1 = [i for i in range(min(l), max(l) + 1) if i not in l]
    d = {}
    for i in range(len(k1)):
        d[k1[i]] =max(k1[i],k)-min(k1[i],k)
    k2 = min(d, key=d.get)
    if len(d)==0:
      print(0)
    else:
      print(k2)

Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)

Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
if n == 0:
    print(0)
else:
    l = list(map(int, input().split()))
    l.sort()
    k1 = [i for i in range(min(l), max(l) + 1) if i not in l]
    d = {}
    for i in range(len(k1)):
        d[k1[i]] =max(k1[i],k)-min(k1[i],k)
    k2 = min(d, key=d.get)
    print(k2)

Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)

Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
if n==0:
    print(0)
else:
    l=list(map(int,input().split()))
    l.sort()
    k1=[i for i in range(min(l),max(l)+1) if i not in l]
    d={}
    for i in range(len(k1)):
        d[k1[i]]=abs(k1[i]-k)
    k2=min(d,key=d.get)
    print(k2)


Fixed submission:
x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)