#include <stdio.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007

#include <stdio.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main (void) {
    int x, n, p[100], i, j, c, flg = 0;

    scanf("%d %d", &x, &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &(p[i]));
    }

    /*
     qsort(p, n, sizeof(int), compare_int);

    c = 0;

    for (i = 0; i < n; i++) {
        if (abs(x - p[i]) < abs(x - p[c])) {
            c = i;
        }
    }
    */

    for (i = 0; i < 100; i++) {
        flg = 0;
        c = (int)pow(-1, i) * (int)((i + 1) / 2);

        for (j = 0; j < 100; j++) {
            if (x + c == p[j]) {
                flg = 1;
                break;
            }
        }

        if (flg == 0) break;
    }

    printf("%d", x + c);

    return 0;
}

