def main():

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

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

    if not x in p:

        print(x)

    else:

        a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]

        print((a.index(min(a))-1))



if __name__ == "__main__":

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

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

if not x in p:

  print(x)

else:

  a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]

  print((a.index(min(a))-1))
def main():
    x, n = list(map(int, input().split()))
    p = set(map(int, input().split()))
    if not x in p:
        print(x)
    else:
        a = [abs(x - i) if not i in p else 1000 for i in range(-1, 102)]
        print((a.index(min(a)) - 1))


if __name__ == "__main__":
    main()

x, n = list(map(int, input().split()))
p = set(map(int, input().split()))
if not x in p:
    print(x)
else:
    a = [abs(x - i) if not i in p else 1000 for i in range(-1, 102)]
    print((a.index(min(a)) - 1))

-def main(): -    x, n = list(map(int, input().split())) -    p = set(map(int, input().split())) -    if not x in p: -        print(x) -    else: -        a = [abs(x - i) if not i in p else 1000 for i in range(-1, 102)] -        print((a.index(min(a)) - 1)) - - -if __name__ == "__main__": -    main() +x, n = list(map(int, input().split())) +p = set(map(int, input().split())) +if not x in p: +    print(x) +else: +    a = [abs(x - i) if not i in p else 1000 for i in range(-1, 102)] +    print((a.index(min(a)) - 1))