#include <stdio.h>
#include <stdlib.h>
#include <math.h>
extern int scanf (__const char *__restrict __format, ...) __wur;
# define __attribute_warn_unused_result__ \
   __attribute__ ((__warn_unused_result__))
#   define __wur __attribute_warn_unused_default__
int main(void){
    int x, n;
    int p[100];
    p[0] = -1;
    int tmp = 0;
    
    scanf("%d %d", &x, &n);
    
    //if(x==NULL) exit(0);
    //if(n==NULL) exit(0);
    if(n==0){
        printf("%d", x);
        exit(0);
    }
    
    int i, j;
    for(i=1;i<=n;i++){
        scanf("%d", &p[i]);
    }
    
    for(i=1;i<=198;i++){
        x = x + pow(-1, i) * i;
        for(j=1;j<=n;j++){
            if(x==p[j]) tmp++;
        }
        if(tmp==0) break;
        tmp =0;
    }
    
    printf("%d\n", x);
    
    return 0;
}