function Main(input) {
input = input.split("\n");
aa = input[0].split(" ");
p = input[1].split(" ");

var x = parseInt(aa[0], 10);
var n = parseInt(aa[1], 10);
  
  for (var i = 0; i < n; i++) {
   p[i]=parseInt(p[i], 10);
  }  

for (var i = 0; i < 101; i++) {
 var s = x - i
 var r = x + i
 
 if (p.indexOf( s ) == -1){
  var result = s;
   break;
   
  } else if (p.indexOf( r ) == -1){
  var result = r;
   break;
  
  } else {
    }
 }
console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));