import math
import sys

x,n=(int(x) for x in input().split())

if (x<1)or(100<x)or(n<0)or(100<n):
    sys.exit(0)

p = 0
for i in range(n):
    p.append(int(input()))
    if p[i]=='':
        print(x)
        sys.exit()
    if (p[i]<1)or(100<p[i]):
        sys.exit(0)

j = 0;

while True:
    l = x-j;
    r = x+j;

    if (l in p)==False:
        print(l)
        sys.exit()

    if (r in p)==False:
        print(r)
        sys.exit()

    j += 1
