#include <bits/stdc++.h>
using namespace std;

int main()
{
    int X, N, atai, M,M2;
    cin >> X >> N;
    vector<int> p(N + 2), sa(100, 0), sa2(100, 999);
    bool dekita = false;
    p.at(0) = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> p.at(i);
    }
    if (p.at(0) == 0)
    {
        dekita = true;
        atai = X;
    }
    sort(p.rbegin(), p.rend());

    for (int i = 0; i < 101; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (X - i == p.at(j))
            {
                M = j;
            }
            if (X + i == p.at(j))
            {
                M2 = j;
            }
        }
            if(dekita==true)
            {
                cout << atai << endl;
                break;
            }
            else if (X - i != p.at(M)&&X-i!=p.at(M2))
            {
                atai = X - i;
                cout << atai << endl;
                break;
            }
            else if (X + i != p.at(M)&&X+i!=p.at(M2))
            {
                atai = X + i;
                cout << atai << endl;
                break;
            }
    }
}
