#include<stdio.h>
int main()
{
    int x,n;
    scanf("%d %d",&x,&n);
    int b,i,a[101]= {0};

    for(i=0; i<n; i++)
    {
        scanf("%d",&b);
        a[b] = 1;
    }

    if(n==0)
        printf("%d\n",x);
    else
    {
        int j=x,k=x,ans1=0,ans2=0;

        while(1)
        {
            if(a[++j]==0)
                ans1 = j;

            if(a[--k]==0)
                ans1 = k;

            if(ans1!=0 || ans2!=0)
                break;
        }

        if(ans1>0 && ans2==0)
            printf("%d\n",ans1);
        else if(ans2>0 && ans1==0)
            printf("%d\n",ans2);
        else
            printf("%d\n",ans1>ans2?ans2:ans1);
    }

    return 0;
}
