using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
namespace AtCoder_1
{
    class Program
    {
        //todo: empty array
        static void Main(string[] args)
        {
            var xn = CinTAr();
            int[] p = new int[0];
            if(xn[1] != 0)
            {
                p = CinTAr();
            }
            else
            {
                Cin();
            }
            int tar = 0;
            for(int i = 0; i <= 128; i++)
            {
                tar = xn[0] - i;
                if(Array.IndexOf(p, tar) < 0)
                {
                    break;
                }
                tar = xn[0] + i;
                if (Array.IndexOf(p, tar) < 0)
                {
                    break;
                }
            }
            Cout(tar);

            Cin();
        } //main

        static readonly int MOD10_9_7 = (1000000000 + 7);
        static Random Rand = new Random();
        static readonly string[] AlphabetTable = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
        static int GetDigits(long num) { return (int)Floor(Log10(num)) + 1; }
        static int GetNumByDigit(long num, int digit)
        {
            return (int)((num / ((int)Pow(10, digit - 1))) % 10);
        }
        static int Loop(int num, int max)
        {
            if (num > max) { return num % max - 1; }
            else if (num < 0) { return max - (-num) % max + 1; }
            else { return num; }
        }
        static long GCD(long a, long b)
        {
            if (a < b) { return GCD(b, a); }
            if (a % b == 0) { return b; }
            else { return GCD(b, a % b); }
        }
        static long LCM(long a, long b) { return a * b / GCD(a, b); }
        static void Swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
        static void SwapArE<T>(T[] a, int i, int j) { T t = a[i]; a[i] = a[j]; a[j] = t; }
        static void SwapLiE<T>(List<T> a, int i, int j) { T t = a[i]; a[i] = a[j]; a[j] = t; }
        static bool IsInt(double d) { return (int)d == d; }
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void Cout(object s) { WriteLine(s); }
        static string RevStr(string s) { return new string(s.Reverse().ToArray()); }
        static long[] Divisor(long n)
        {
            if (n == 1) { return new long[] { 1 }; }
            List<long> res = new List<long>() { 1 };
            for (long i = 2; i <= n / 2 + 1; i++) { if (n % i == 0) { res.Add(i); } }
            res.Add(n);
            return res.ToArray();
        }
        static IEnumerable<decimal> PrimeFactors(decimal n)
        {
            decimal i = 2;
            decimal tmp = n;
            while (i * i <= n)
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else { i++; }
            }
            if (tmp != 1) yield return tmp;//最後の素数も返す
        }
        static bool IsPrime(long num)
        {
            if (num == 1) { return false; }
            for (long i = 2; i <= Sqrt(num) + 1; i++) { if (num % i == 0) { return false; } }
            return true;
        }
        static void CoutAr<Type>(IEnumerable<Type> types) { Cout(string.Join(" ", types)); }
        static long nCr(int n, int r) { return nPr(n, r) / Factorial(r); }
        static long nPr(int n, int r) { return FactorialDivision(n, n - r); }
        static long FactorialDivision(int topFactorial, int divisorFactorial)
        {
            long r = 1;
            for (int i = topFactorial; i > divisorFactorial; i--) { r *= i; }
            return r;
        }
        static long Factorial(int i)
        {
            if (i <= 1) { return 1; }
            return i * Factorial(i - 1);
        }
        static void CoutMemPairAr<Type>(IEnumerable<Pair<Type>> pairs)
        {
            var ar = pairs.ToArray();
            for (int i = 0; i < ar.Length; i++) { Write($"({ar[i].a}, {ar[i].b}, {ar[i].c}), "); }
            Cout("");
        }
    }
    public struct Pair<T>
    {
        public T a, b, c;
        public Pair(T _a, T _b, T _c = default(T)) { a = _a; b = _b; c = _c; }
    }
}


Measured memory_bytes: 19800