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

int main(void){
    int x, n;
    int p[100];
    p[0] = -1;
    int tmp = 0;
    
    if(scanf("%d %d", &x, &n) < 2) {
        fprintf(stderr, "error: ill-formed fraction.\n");
        exit(1);
    }
    if(n==0){
        printf("%d\n", x);
        exit(0);
    }
    
    int i, j;
    for(i=1;i<=n;i++){
        if(scanf("%d", &p[i]) < 1) {
            fprintf(stderr, "error: ill-formed fraction.\n");
            exit(1);
        }
    }
    
    for(i=1;i<=102;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;
}