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

int main(void)
{
    int i, j, sa, a=100, c, judge=0;
    int X, N;
    scanf("%d",&X);
    scanf("%d",&N);
    int data[N];

    for(i=0; i<N; i++) {
        scanf("%d",&data[i]);
    }

    for(i=0; i<=100; i++){
        for(j=0;j<N;j++){
            if(i == data[j]){
                judge = 1;
                break;
            }
        }
        if(judge != 1) {
            sa = abs(X - i);
            if(sa < a) {        
                a = sa;
                c = i;
            }
        } else {
            judge = 0;
        }
    }

    printf("%d\n", c);

    return 0;
}