#include <stdio.h>
#define SIZE 101

int main(void){
    int x, n, i, p, count[SIZE] = {0}, a, b, ans;
    scanf("%d %d", &x, &n);
    for(i = 0; i < n; i++){
        scanf("%d", &p);
        count[p]++;
    }
    a = x;
    while(count[a] != 0)
        a--;
    b = x;
    while(count[b] != 0)
        b++;
    ans = (x - a <= b - x) ? a : b; 
    printf("%d", ans);
    return 0;
}