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

int main() {
	int x, n;
	cin >> x >> n;
	map<int, bool> mp;
	for (int i = 0, y; i < n; ++i) {
		cin >> y;
		mp[y] = true;
	}
	
	int ans = 150;
	
	for (int i = 101; i >= -1; --i) {
		if (!mp[i] && abs(x-i) <= abs(x-ans)) {
			ans = i;
		}
	}
	
	cout << ans << "\n";
}

