#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <regex>
#include <cmath>
#include <bitset>
#include <array>
#include <deque>
#include <list>
#include <stack>
#include <iterator>
#include <random>
#include <cctype>

#define DEBUG_OUTPUT 0

#if DEBUG_OUTPUT
#define debug(...) debug_output(__VA_ARGS__)
#define debug_output_matrix(...) debug_output_matrix_impl(__VA_ARGS__)
#else
#define debug(...)
#define debug_output_matrix(...)
#endif

using namespace std;

using s32 = int32_t;
using u32 = uint32_t;
using s64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;

// ==== I/O
const char newline = '\n';

template<class T>
void input(T& val) {
    cin >> val;
}

template<class Head, class... Args>
void input(Head& val, Args&... args){
    input(val);
    input(args...);
}

template<class T>
T input() {
    T val;
    input(val);
    return val;
}

template<class T>
std::vector<T> input_vector(int n) {
    std::vector<T> res;
    for(int i=0;i<n;i++){
        res.emplace_back(input<T>());
    }
    return res;
}

template<class T>
void output(const T& val){
    cout << val;
}
template<class T1,class T2>
void output(const T1& val, const T2& val2){
    output(val);
    if(val2 != newline)
        output(' ');
    output(val2);
}

template<class T1, class T2, class... Args>
void output(const T1& val, const T2& val2, Args&&... args){
    output(val);
    output(' ');
    output(val2, args...);
}

#if DEBUG_OUTPUT
template<class T>
void debug_output(const T& val){
    cerr << val;
}
template<class T1,class T2>
void debug_output(const T1& val, const T2& val2){
    debug_output(val);
    if(val2 != newline)
        output(' ');
    debug_output(val2);
}

template<class T1, class T2, class... Args>
void debug_output(const T1& val, const T2& val2, Args&&... args){
    debug_output(val);
    debug_output(' ');
    debug_output(val2, args...);
}
#endif

template<class T>
vector<vector<T>> make_matrix2(T val, int a, int b){
    return vector<vector<T>>(
        a, vector<T>(b, val)
    );
}

template<class T>
void debug_output_matrix_impl(const vector<vector<T>>& v) {
    cerr << "========" << endl;
    for(const auto& a: v){
        for(const auto& b : a){
            cerr << b << " ";
        }
        cerr << endl;
    }
    cerr << endl;
}

// === math
s64 gcd(s64 a, s64 b) {
    return b?gcd(b,a%b):a;
}
s64 lcm(s64 a, s64 b) {
    return a / gcd(a, b) * b;
}

// =======================

int main(){
    s32 x, n;
    input(x, n);
    s32 INF = 1 << 30;
    s32 diff = INF;
    s32 ans = -1;
    vector<s32> v;
    for(int i=0;i<n;i++){
        v.push_back(input<s32>());
    }
    for(int i=-1;i<=101;i++){
        bool exist = false;
        for(auto& p : v){
            if(p == i){
                exist = true;
                break;
            }
        }
        if(exist)
            continue;
        auto d = abs(i - x);
        if(d < diff){
            diff = d;
            ans = i;
        }else if(d == diff && i < ans){
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3632