/*
--------------------------------DO NOT COPY I REQUEST YOU PLEASE--------------------------

AUTHOR : Chandan Agrawal
College : Poornima College of Engg. jaipur, Raj
Mail : chandanagrawal23@gmail.com


 ██████╗ ██╗  ██╗  █████╗  ███╗   ██╗ ██████╗   █████╗  ███╗   ██╗
██╔════╝ ██║  ██║ ██╔══██╗ ████╗  ██║ ██╔══██╗ ██╔══██╗ ████╗  ██║
██║      ███████║ ███████║ ██╔██╗ ██║ ██║  ██║ ███████║ ██╔██╗ ██║
██║      ██╔══██║ ██╔══██║ ██║╚██╗██║ ██║  ██║ ██╔══██║ ██║╚██╗██║
╚██████╗ ██║  ██║ ██║  ██║ ██║ ╚████║ ██████╔╝ ██║  ██║ ██║ ╚████║
 ╚═════╝ ╚═╝  ╚═╝ ╚═╝  ╚═╝ ╚═╝  ╚═══╝ ╚═════╝  ╚═╝  ╚═╝ ╚═╝  ╚═══╝

 min{max{x,y},max{x,z}} = max{x,min{y,z}}
 max{min{x,y},min{x,z}} = min{x,max{y,z}}
 gcd{lcm{a,b},lcm{a,c}} = lcm{a,gcd{b,c}}
 lcm{gcd{a,b},gcd{a,c}} = gcd{a,lcm{b,c}}

 sort(s.begin(), s.end(), [&](char a, char b) {
            return counts[a] > counts[b] || (counts[a] == counts[b] && a < b);
        });

*/

#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb emplace_back
#define INF 1000000000
#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define loop(i,n) for (lli i = 0; i < n; i++)
#define loopitr(xt,vec) for (auto xt : vec)
#define FOR(i,a,b) for (lli i = a; i < b; i+=1)
#define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
#define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
#define itr :: iterator it
#define WL(t) while(t --)

#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>
#define vi vector<lli>
#define seti set<lli>
#define pii pair<lli,lli>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.push_back(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvector(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";
#define printset(st) for(auto xt : st) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define endl '\n'

#define deb(x) cout<<#x<<" "<<x<<endl;

/*
ifstream cinn("i3.txt");
ofstream coutt("o3.txt");

u can use (__int128)n when required
*/


/*lli find_mod(string s){
lli i,x=0;
for(i=0;i<s.length();i++)
    x=(x*10+s[i]-'0')%mod;
return x;
}
*/

bool prime[MAX+1];

void sieve1(){ //prime or not
    for(int i=0;i<=MAX;i++) prime[i]=1;
    prime[0]=prime[1]=0;
    for(lli i=4;i<=MAX;i+=2) prime[i]=0;
    for (int p=3; p*p<=MAX; p+=2){
        if (prime[p] == 1)
            for (int i=p*2; i<=MAX; i += p){
                prime[i] = 0;
}}}

/*
lli spf[MAX+1];

void sieve2(){ //smallest prime factor of N.

    loop(i,MAX+1) spf[i]=i;
    for(lli i=4;i<=MAX;i+=2) spf[i]=2;

    for(lli i=3; i*i<=MAX; i+=2){
        if (spf[i] == i){
            for (int j=i*i; j<=MAX; j+=i)
                if (spf[j]==j) //marking spf[j] if it is not previously marked
                    spf[j] = i;
        }
    }
}

lli lpf[MAX+1];

void sieve3(){ //largest prime factor of N
    loop(i,MAX+1) lpf[i]=i;
    for(lli i=4;i<=MAX;i+=2) lpf[i]=2;

    for(lli i=3; i*i<=MAX; i++) {
        if (lpf[i] == i){
            for (int j=2*i; j<=MAX; j+=i)
                    lpf[j] = i;
        }
    }
}

lli tfactor[MAX+1];
lli sumfactor[MAX+1];
void sieve4(){ // totalfactor and sum_of_all_factors
    // n = (a^p)*(b^q)*(c^r)....
    // totalfactors = (p+1)*(q+1)*(r+1)...
    // sumoffactors =  [(a^(p+1)-1)/(a-1))]*[(b^(q+1)-1)/(b-1))]*[(c^(r+1)-1)/(c-1))]....
    sieve2();
    tfactor[1] = sumfactor[1] =1;
    for(lli i=2;i<=MAX;i++){
        lli mspf = spf[i];
        lli prim = mspf;
        lli temp = i;
        lli cnt=0;
        while(temp%mspf==0){
            temp/=mspf;
            cnt+=1;
            prim = prim*mspf;
        }
        tfactor[i] = (cnt+1) * tfactor[temp];
        sumfactor[i] = (prim -1)/(mspf-1) * sumfactor[temp];
     }
}
vector<int>all_div[1000001];
void alldivisors(){
for(int i=1;i<=1000000;++i){
        for(int j=i;j<=1000000;j+=i)
            all_div[j].pb(i);
    }
}
/*
int mobius[MAX+1];
void mobiusfunction(){
sieve2();
mobius[1]=1;
for(int i=2;i<=MAX;i++){
    if(spf[i/spf[i]] == spf[i])
        mobius[i]=0;
    else
        mobius[i] = -1*(mobius[i/spf[i]]);
    }
}
/*
bool is_even(lli n){ return(!(n&2));}

bool is_odd(lli n){ return(n&2);}

// memset(array_name , initialized value , sizeof(data_type_of_array))

bool isPrime(lli n){
if(n<=1) return false;
if(n<=3) return true;
if(n==5) return true;
if((n%2==0)||(n%3==0) || (n%5==0)) return false;
for(lli i=5;i*i<=n;i+=6)
    if((n%i==0)||(n%(i+2)==0))
        return false;
return true;
}

lli reversenum(lli x){
lli num=0;
while(x>0){
    num=num*10+x%10;
    x=x/10;
    }
return num;
}

bool ispalindrome(string s){
string q = s;
reverse(q.begin(),q.end());
return(s==q);
}
*/

bool isvowel(char v) { return (0x208222>>(v&0x1f))&1; }

lli mceil(lli a,lli b){
    if(a%b==0) return(a/b);
    else return(a/b  +1);
}
lli mfloor(lli a,lli b){
    return(a/b);
}
/*
lli sumarr(lli a[],lli n){
    lli sum=0;
    loop(i,n) sum+=a[i];
    return sum;
}

ll modmullong(ll a,ll b){
    ll  res = 0;
    a %= mod;
    while (b){
        if (b & 1)
            res = (res + a) % mod;
        a = (2 * a) % mod;
        b >>= 1;
    }
    return res;
}
*/
/*
ll modmul2(ll a, ll b) {
    return (((a%(mod-1)) * (b%(mod-1))) % (mod-1));
}
*/
ll modmul(ll a, ll b) {
    return ((a%mod) * (b%mod)) % mod;
}

ll modadd(ll a , ll b){
    return((a%mod)+(b%mod)+mod)%mod;
}

ll modsub(ll a , ll b){
    return((a%mod) - (b%mod) + mod)%mod;
}

lli fastexpo(lli a,lli b ,lli MOD = mod){
    a = a%MOD;
    //b = b%(mod-1); // if mod is prime then only
    lli ans=1;
    while(b){
        if(b&1)
            ans=(ans*1ll*a)%MOD;
        a=(a*1ll*a)%MOD;
        b=b/2;
        }
    return ans;
 }

/*lli phi[MAX];
void euler_phi(){ //euler totient function
loop(i,MAX-1)
    phi[i+1] = i+1;
for (lli p=2; p<MAX; p++){
    if (phi[p] == p){
        phi[p] = p-1;

        for (lli i = 2*p; i<MAX; i += p)
               phi[i] = (phi[i]/p) * (p-1);

        }
    }
}

lli myphi(lli n)
{
    lli result = n;
    for (lli p = 2; p * p <= n; ++p) {
        if (n % p == 0) {
            while (n % p == 0)
                n /= p;
            result -= result / p;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}


void prime_factorise(lli n , map<lli,lli> &mp){

    while(n%2==0){
        mp[2]++;
        n/=2;
    }
    for(lli i=3;i*i<=n;i+=2){
        while(n%i==0){
            mp[i]++;
            n/=i;
        }
    }

    if(n>1) mp[n]++;

 }*/

lli cntbits(lli n){
    lli cnt=0;
    while(n){
        cnt++;
        n/=2;
    }
    return cnt;
}
/*
vi divisors(lli n){
    vi div;
    for(lli i=1;i*i<=n;i++){
        if(n%i==0){
            if(n/i == i)
                div.pb(i);
            else{
                div.pb(i);
                div.pb(n/i);
                }
        }
    }
    sort(all(div));
    return div;
}
*/
lli fact[100001];
void facto(){
    fact[0] = 1;
    for(lli i=1;i<=100000;i++)
        fact[i]  = modmul(fact[i-1],i);
}
/*
lli nCr(lli n,lli r){
// nCr % p = (fac[n]* modIverse(fac[r]) % p *modIverse(fac[n-r]) % p) % p;
//Here modIverse() means modular inverse under

    if(n<r)
        return 0;
    else{
        facto();
        lli ans = modmul(modmul(fact[n] , fastexpo(fact[r],mod-2)) , fastexpo(fact[n-r],mod-2));
        return ans;
    }
}
bool ispower2(lli n){
    return(n and (n&(n-1))==0 );
}

vector<string> split(string s,char ch){
    vector<string> ans;
    string temp="";
    for(lli i=0;i<sz(s);i++){
        if(s[i]==ch){
            ans.pb(temp);
            temp="";
        }
        else{
            temp+=s[i];
        }
    }
    ans.pb(temp);
    return ans;
}
*/


// chandan1,2
void chandan1(){int y=1;return;}
void chandan2(){
        loop(i,10){
        lli x=1;
    }
    return(chandan1());
}



int main(){
fastio
lli t=1;
//cin>>t;
chandan2();
while(t--) {
    lli x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x<<endl;
        return 0;
    }
    lli a[n];
    scanarr(a,n);
    mii dp;
    loop(i,n){
        dp[a[i]]=1;
    }
    lli diff = 999999999;
    lli ans = -1000;
    for(lli i=-1000;i<=1001;i++){
        if(dp.find(i)==dp.end()){
            lli crdiff = abs(x-i);
            if(diff>crdiff){
                diff = crdiff;
                ans = i;
            }
        }
    }
    cout<<ans<<endl;

  }
return 0;
}


Measured memory_bytes: 3664