#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    int x, n;
    int p[100];
    p[0] = -1;
    int tmp = 0;
    
    scanf("%d%d",&x, &n);
    
    if(n==0) 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;
}