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

int x, n;
int p[200];

int main( int argc, char *argv[] )
{
    int ppp;

    scanf( "%d %d", &x, &n );
    for( int i=0; i<n; i++ ) {
        scanf( "%d", &ppp );
        p[ppp] = 1;
    }

    for( int i=0; i<100; i++ ) {
        if( p[x-i] == 0 ) {
            printf( "%d\n", x-i );
            exit(0);
        } else if( p[x+i] == 0 ) {
            printf( "%d\n", x+i );
            exit(0);
        }
    }
}
