#include<stdio.h>
#include <stdlib.h>
int main() {
    int x,n;
    scanf("%d %d",&x,&n);
    int p[102];
    for(int i = 0; i <= 101; i++) {
        p[i] = 0;
    }
    for(int i = 0;i < n; i++) {
        int a;
        scanf("%d", &a);
        p[a] = 1;
    }
    int ans = 0;
    int min = 1000;
    for (int i = 0; i <= 101; i++) {
        if (p[i] == 0) {
            if (min > abs(x-i)) {
                min = abs(x-i);
                ans = i;
            }
        }
    }
    printf("%d\n",ans);
}