#!usr/bin/env python3

from collections import defaultdict, deque

from heapq import heappush, heappop

from itertools import permutations, accumulate

import sys

import math

import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())

def LS():return [list(x) for x in sys.stdin.readline().split()]

def S():

    res = list(sys.stdin.readline())

    if res[-1] == "\n":

        return res[:-1]

    return res

def IR(n):

    return [I() for i in range(n)]

def LIR(n):

    return [LI() for i in range(n)]

def SR(n):

    return [S() for i in range(n)]

def LSR(n):

    return [LS() for i in range(n)]



sys.setrecursionlimit(1000000)

mod = 1000000007



def solve():

    x,n = LI()

    p = LI()

    f = [1]*(200)

    for i in p:

        f[i] = 0

    ans = x

    m = 0

    for i in range(200):

        if f[i]:

            d = abs(i-x)

            if d < ans:

                ans = d

                m = i

    print(m)

    return



#Solve

if __name__ == "__main__":

    solve()

x, n = list(map(int, input(). split()))

m = [0]*200

ans = 0

if n > 0:

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

else:

  print(x)

  quit()

for i in range(n):

  l = abs(x-p[i])

  m[l] += 1

if m[0] == 0:

  print(x)

else:

  for j in range(1, 200):

    if m[j] < 2:

      a = x-j

      A = x+j

      if a not in p:

        ans = a

      else:

        ans = A

      break

  print(ans)

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def I():
    return int(sys.stdin.readline())


def LS():
    return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    x, n = LI()
    p = LI()
    f = [1] * (200)
    for i in p:
        f[i] = 0
    ans = x
    m = 0
    for i in range(200):
        if f[i]:
            d = abs(i - x)
            if d < ans:
                ans = d
                m = i
    print(m)
    return


# Solve
if __name__ == "__main__":
    solve()

x, n = list(map(int, input().split()))
m = [0] * 200
ans = 0
if n > 0:
    p = list(map(int, input().split()))
else:
    print(x)
    quit()
for i in range(n):
    l = abs(x - p[i])
    m[l] += 1
if m[0] == 0:
    print(x)
else:
    for j in range(1, 200):
        if m[j] < 2:
            a = x - j
            A = x + j
            if a not in p:
                ans = a
            else:
                ans = A
            break
    print(ans)

-#!usr/bin/env python3 -from collections import defaultdict, deque -from heapq import heappush, heappop -from itertools import permutations, accumulate -import sys -import math -import bisect - - -def LI(): -    return [int(x) for x in sys.stdin.readline().split()] - - -def I(): -    return int(sys.stdin.readline()) - - -def LS(): -    return [list(x) for x in sys.stdin.readline().split()] - - -def S(): -    res = list(sys.stdin.readline()) -    if res[-1] == "\n": -        return res[:-1] -    return res - - -def IR(n): -    return [I() for i in range(n)] - - -def LIR(n): -    return [LI() for i in range(n)] - - -def SR(n): -    return [S() for i in range(n)] - - -def LSR(n): -    return [LS() for i in range(n)] - - -sys.setrecursionlimit(1000000) -mod = 1000000007 - - -def solve(): -    x, n = LI() -    p = LI() -    f = [1] * (200) -    for i in p: -        f[i] = 0 -    ans = x -    m = 0 -    for i in range(200): -        if f[i]: -            d = abs(i - x) -            if d < ans: -                ans = d -                m = i -    print(m) -    return - - -# Solve -if __name__ == "__main__": -    solve() +x, n = list(map(int, input().split())) +m = [0] * 200 +ans = 0 +if n > 0: +    p = list(map(int, input().split())) +else: +    print(x) +    quit() +for i in range(n): +    l = abs(x - p[i]) +    m[l] += 1 +if m[0] == 0: +    print(x) +else: +    for j in range(1, 200): +        if m[j] < 2: +            a = x - j +            A = x + j +            if a not in p: +                ans = a +            else: +                ans = A +            break +    print(ans)