import std.stdio;

void main() {
	int x, n;
	readf("%s %s", &x, &n);
	auto forbiddenList = new bool[101];

	foreach (i;0..n) {
		int a;
		readf(" %s", &a);
		assert(a < forbiddenList.length);
		forbiddenList[a] = true;
	}

	bool isForbidden(int a) {
		if (a >= 0 && a < forbiddenList.length) {
			return forbiddenList[a];
		}
		return false;
	}

	for (int i = 0;i < forbiddenList.length;++i) {
		if (!isForbidden(x - i)) {
			writeln(x - i);
			return;
		}
		if (!isForbidden(x + i)) {
			writeln(x + i);
			return;
		}
	}

	assert(false);
}
