/*
    forbidden_list.c
    2020/06/14
*/

#include <stdio.h>

int main()
{
    int x, n, i, j, tmp;
    int arr[102] = {0};
    scanf("%d %d", &x, &n);
    if (n == 0){
        printf("%d", x);
        return 0;
    }
    if (n == 100){
        printf("%d", x);
        return 0;
    }
    for (i = 0; i < n; i++){
        scanf("%d", &tmp);
        arr[tmp] = 1;
    }
    for (j = 0; (0 <= x - j)&&(x + j <= 100); j++){
        if(arr[x - j] == 0){
            printf("%d", x - j);
            break;
        }
        if(arr[x + j] == 0){
            printf("%d", x + j);
            break;
        }
        
    }
   return 0;
}


