// Author: pankaj_m05

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f_in(file) freopen(file, "r", stdin)
#define f_out(file) freopen(file, "w", stdout)
#define sz(a) int((a).size())
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) c.begin(), c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())  // Set and Maps
#define cpresent(c,x) (find(allc,x) != c.end()) // Vectors
using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef long long ll;

const int mod = 1e9 + 7;
const int mxN = 100;
int n, x;
bool a[mxN + 2];

void testcase() {
	cin >> x >> n;
	if (n == 0) {
		cout << x << '\n';
		return;
	}
	for (int i=0;i<n;i++) {
		int t;
		cin >> t;
		a[t] = 1;
	}
	int l=0, r=100;
	for (int i=x; i>=0; --i) {
		if(a[i])
			continue;
		l = i;
		break;	
	}
	for (int i=x; i<102; ++i) {
		if(a[i])
			continue;
		r = i;
		break;	
	}
	cout << (x-l<=r-x?l:r) << '\n';
}

int main(void) { 
	fast
	testcase();
	return 0;
}                                          