#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int X = 0;
    int N = 0;
    int p[100] = {0};
    int ans[100] = {0};
    int a = 0;
    int i = 0;
    int j = 0;

    scanf("%d %d", &X, &N);

    for (i = 0; i < N; i++)
    {
        scanf("%d", &p[i]);
        ans[abs(X - p[i])] += 1;
    }
    for (i = 1; i < 100; i++)
    {
        if (ans[i] == 0 || ans[i] == 1)
        {
            a = i;
            break;
        }
    }
    for (i = 0; i < N; i++)
    {
        if (p[i] == (X - a))
        {
            printf("%d\n", X + a);
            return;
        }
    }
    printf("%d\n", X - a);
    return 0;
}
