#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,c,i,ans;
cin>>c>>n;
int a[n];
ans=c;
for(i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
for(i=0;i<=n;i++)
{
if(!binary_search(a,a+n,c-i)&&(c-i)>=0)
{
cout<<c-i<<endl;
break;
}
else if(!binary_search(a,a+n,c+i))
{
cout<<c+i<<endl;
break;
}
}

}
