/* Author:bhagatsunny96
         JGEC
	   template*/
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
#define loopr(n) for(long long int i=n-1;i>=0;i--)
#define lrp(a,b) for(long long int i=a;i<=b;i++)
#define lrn(a,b) for(long long int i=b;i>=a;i--)
#define ivec vector<ll>
#define ivecp vector<pair<ll,ll>>
#define imap map<ll,ll>
#define uimap unordered_map<ll,ll>
#define iset set<ll>
#define cvec vector<char>
#define civecp vector<pair<char,ll>>
#define cimap map<char,ll>
#define ucimap unordered_map<char,ll>
#define cset set<char>
#define rr return 0
using namespace std;
//Declaration
const ll N=5e5+5;
vector<ll>adj[N];
bool visited[N]={false};
ll parent[N];
ll rnk[N];
ll degree[N];
vector<ll>ax;



//Function call
void tr(vector<ll> &dx);
bool isprime(ll n);
bool ispalin(ll num);
ll lcm(ll a, ll b); 
ll power(ll x,ll y);
ll sumofdigits(ll n);
bool sortinrev(const pair<ll,ll>&a,const pair<ll,ll>&b);
bool sortbysec(const pair<string,ll> &a, const pair<string,ll> &b);
void make(ll a);
ll find(ll a);
void Union(ll a,ll b);
bool isSubSequence(string& str1, string& str2, ll m, ll n);
void luck(ll n);
bool isSubstring(string s1, string s2);
vector<ll>lucky;


//solve
void solve()
{
    ll n,x;
    cin>>x>>n;
    ll arr[n];
    imap mx;
    loop(n)
    {
        cin>>arr[i];
        mx[arr[i]]++;
    }
    ll diff,diff2;
    ll ans=0;
    for(ll i=x;i>=0;i--)
    {
        if(mx.find(i)==mx.end())
        {
            diff=abs(i-x);
            ans=i;
            break;
        }
    }
    ll an2=101;
    for(ll i=x+1;i<=101;i++)
    {
        if(mx.find(i)==mx.end())
        {
            diff2=abs(x-i);
            an2=i;
            break;
        }
    }
    diff2=abs(x-an2);
    diff=abs(x-ans);
    if(diff2<diff)
    {
        ans=an2;
    }
    else
    {
        ans=ans;
    }
    cout<<ans<<endl;
}









//--------------------------------------------------------------------------------------------------//
//Functions
void tr(vector<ll> &dx)
{
    ll ctr=0;
    char ch,ch1,ch2,ch3,ch4;
    while(ctr<300)
    {
        if(dx.size()<4)
        {
            for(ll i=0;i<dx.size();i++)
            {
                ll m=dx[i];
                cout<<m<<endl;
                ctr++;
                cin>>ch;
                if(ch=='E')
                {
                    return;
                }
            }
        }
        ll x=dx.size();
        ll l=x/3;
        ll h=l*2;
        cout<<dx[l]<<endl;
        ctr++;
        cin>>ch1;
        if(ch1=='E')
        return;
        cout<<dx[h]<<endl;
        ctr++;
        cin>>ch2;
        if(ch2=='E')
        {
            return;
        }
        if(ch1=='L' && ch2=='L')
        {
            vector<ll>vl;
            for(ll j=0;j<=h;j++)
            {
                vl.pb(dx[j]);
            }
            dx=vl;
            continue;
        }
        else if(ch1=='G' && ch2=='G')
        {
            vector<ll>vl;
            for(ll j=l+1;j<dx.size();j++)
            {
                vl.pb(dx[j]);
            }
            dx=vl;
            continue;
        }
        cout<<dx[h]<<endl;
        ctr++;
        cin>>ch3;
        if(ch3=='E')
        {
            return;
        }
        if(ch2=='L' && ch3=='L')
        {
           vector<ll>vl;
           for(ll j=0;j<=h;j++)
           {
                vl.pb(dx[j]);
           }
           dx=vl; 
           continue;
        }
        else if(ch2=='G' && ch3=='G')
        {
           vector<ll>vl;
           for(ll j=h+1;j<x;j++)
           {
                vl.pb(dx[j]);
           }
           dx=vl;  
           continue;
        }
        cout<<dx[l]<<endl;
        ctr++;
        cin>>ch4;
        if(ch4=='E')
        {
            return;
        }
        if(ch3=='L' && ch4=='L')
        {
            vector<ll>vl;
            for(ll j=0;j<=h;j++)
            {
                vl.pb(dx[j]);
            }
            dx=vl;
        }
        else if(ch3=='G' && ch4=='G')
        {
            vector<ll>vl;
            for(ll j=l+1;j<x;j++)
            {
                vl.pb(dx[j]);
            }
            dx=vl;
        }
        else
        {
            vector<ll>vl;
            for(ll j=0;j<=l;j++)
            {
                vl.pb(dx[j]);
            }
            for(ll j=h+1;j<x;j++)
            {
                vl.pb(dx[j]);
            }
            dx=vl;
        }
    }
}
bool isSubstring(string s1, string s2) 
{ 
    ll M = s1.length(); 
    ll N = s2.length(); 
  
    /* A loop to slide pat[] one by one */
    for (ll i = 0; i <= N - M; i++) { 
        ll j; 
  
        /* For current index i, check for pattern match */
        for (j = 0; j < M; j++) 
            if (s2[i + j] != s1[j]) 
                break; 
  
        if (j == M) 
            return true; 
    } 
  
    return false; 
}
void luck(ll n)
{
    lucky.pb(n);
    if(n>1e9)
    return;
    luck(n*10+4);
    luck(n*10+7);
}
bool isSubSequence(string& str1, string& str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
  
    if (str1[m-1] == str2[n-1]) 
        return isSubSequence(str1, str2, m-1, n-1); 
    return isSubSequence(str1, str2, m, n-1); 
}
ll lcm(ll a, ll b)  
{  
    return (a*b)/__gcd(a, b);  
}
ll power(ll x, ll y) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}
bool isPrime(ll num)
{
    bool flag=true;
    for(ll i =2;i<=num/2;i++) 
    {
       if(num%i==0) 
       {
          flag=false;
          break;
       }
    }
    return flag;
}
bool isPalin(ll num)
{
    bool flag=false;
    ll digit,rev=0,n=num;
    do
     {
         digit = num % 10;
         rev = (rev * 10) + digit;
         num = num / 10;
     } while (num != 0);
     if(rev==n)
     flag=true;
     return flag;
}
ll sumofdigits(ll n)
{
    ll c=0;
    while(n>0)
    {
        c+=(n%10);
        n/=10;
    }
    return c;
}
bool sortinrev(const pair<ll,ll>&a,const pair<ll,ll>&b) 
{ 
    return (a.first > b.first); 
}
bool sortbysec(const pair<string,ll> &a, const pair<string,ll> &b) 
{ 
    return (a.second < b.second); 
}
//DSU//
void make(ll a)
{
    parent[a]=a;
    rnk[a]=1;
}
ll find(ll a)
{
    if(parent[a]==a)
    return a;
    return parent[a]=find(parent[a]);
}
void Union(ll a,ll b)
{
    a=find(a);
    b=find(b);
    if(a==b)
    return;
    if(rnk[a]>rnk[b])
    {
        parent[b]=a;
        rnk[a]+=rnk[b];
    }
    else
    {
        parent[a]=b;
        rnk[b]+=rnk[a];
    }
}




//Driver Code
int main() 
{
    fIO
    solve();
	rr;
}


Measured memory_bytes: 15376