Buggy python submission (verdict: Runtime Error):
try:
  p = list(map(int, input().split()))
except:
  p = []


l = [0]*100

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))
if N == 0:
  print(X)
else:
  for i in range(N):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

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


l = [0]*200

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))

if N == 0:
  print(X)
else:
  for i in range(N+1):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
try:
  p = list(map(int, input().split()))
except:
  p = []


l = [0]*X

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))
if N == 0:
  print(X)
else:
  for i in range(N):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

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


l = [0]*200

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))

if N == 0:
  print(X)
else:
  for i in range(N+1):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
try:
  p = list(map(int, input().split()))
except:
  p = []


l = [0]*X

for i in range(N):
  l[abs(p[i] - X)] += 1

if N == 0:
  print(X)
else:
  for i in range(N):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(x-i)
          print(X-i)
        except:
          print(X+i)
        break

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


l = [0]*200

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))

if N == 0:
  print(X)
else:
  for i in range(N+1):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

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


l = [0]*N

for i in range(N):
  l[abs(p[i] - X)] += 1

for i in range(N):
  if i == 0:
    if l[0] == 1:
      continue
    else:
      print(X)
  else:
    if l[i] == 0:
      print(X-i)
      break
    elif l[i] == 1:
      try:
        p_index = p.index(x-i)
        print(X-i)
      except:
        print(X+i)
      break

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


l = [0]*200

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))

if N == 0:
  print(X)
else:
  for i in range(N+1):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break