#include<stdio.h>
#include<stdbool.h>

int main(void){
    int x,n;
    scanf("%d",&x);
    scanf("%d",&n);
    if (n == 0){
        printf("%d\n",x);
        return 0;
    }
    int p[n];
    for (int i=0; i<n; i++){
        scanf("%d",&p[i]);
    }
    int l = x - 1;
    int r = x + 1;
    bool lb,rb;
    while (true){
        lb = true;
        rb = true;
        for (int i=0; i<n; i++){
            if (p[i] == l) lb = false;
            if (p[i] == r) rb = false;
            if (!lb && !rb) break;
        }
        if (lb) {
            printf("%d\n",l);
            break;
        }
        if (rb) {
            printf("%d\n",r);
            break;
        }
        --l;
        ++r;
    }
    return 0;
}