#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i,x,n,min = 101,ans,s[100];
    scanf("%d%d",&x,&n);
    int a[n];

    for(i=0;i<100;i++){
        s[i] = i+1;
    }

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

    for(i=0;i<n;i++){
        if(min > abs(x-a[i])){
            min = abs(x-a[i]);
            ans = a[i]-1;
        }
    }

    while(s[ans] == 0){
        ans--;
    }

    printf("%d",s[ans]);
    return 0;
}