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

int X, N, bil;
bool ada[110];
int ans, diff=200;

int main () {
	cin >> X >> N;
	for(int i=0; i<N; i++) {
		cin >> bil;
		ada[bil] = true;
	}
	for(int i=0; i<=101; i++) {
		if (!ada[i]) {
			if (abs(i-X)<diff) {
				diff = abs(i-X);
				ans = i;
			}
		}
	}
	cout << ans << endl;
}
