process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var x = Number(lines[0].split(' ')[0]);
 var n = Number(lines[0].split(' ')[1]);
 var ans = '';
 var a = [];

 if(n === 0){
   ans = x;
 }else{
   var p = lines[1].split(' ');
   p = p.map(function(str) { return Number(str)});

   for(i=0; i<=100; i++){
     var minum = x - i
     if(p.indexOf(minum) === -1){
       ans = minum;
       break;
     }
     var plnum = x + i
     if(p.indexOf(plnum) === -1){
       ans = plnum;
       break;
     }
   }

}
   console.log(ans);
   
 

 
  
 
});