#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 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]));
    }


    for (i = 0; i < 300; 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;
}

