#include <stdio.h>

int main()
{
    int x,n;
    scanf("%d %d ", &x, &n);

    int p[n];
    int i = 0;
    while(1)
    {
        int f = 0;
        for(int j = 0; j < n; j++)
            if(p[j] == x - i)
                f = 1;
        if(f == 0)
        {
            printf("%d\n",x - i);
            return 0;
        }
        f = 0;
        for(int j = 0; j < n; j++)
            if(p[j] == x + i)
                f = 1;
        if(f == 0)
        {
            printf("%d\n",x + i);
            return 0;
        }
        i++;
    }
    return 0;
}