const toInt = x=>parseInt(x,10);
const toIntArr = arr=>arr.map(x=>toInt(x));
const abs = x=>x>0?x:-x;
function min(){let rest = arguments,val=rest[0];for(let i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){let rest = arguments,val=rest[0];for(let i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(inputText){
	let input = inputText.split('\n');
	input = input.map(e => toIntArr(e.split(' ')));
	let x = input[0][0], n = input[0][1], ps = input[1];
	if(n===0){
		console.log(x);return 0;
	}
	let ans = 1000;
	for(let i = 0; i < 100; i++){
		if(ps.indexOf(i+1)===-1 && (i+1-x)<abs(ans)) ans = i+1-x;
	}
	console.log(ans+x);
	return 0;
}