"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    let X = parseInt(arg[0].split(" ")[0]);
    const N = parseInt(arg[0].split(" ")[1]);
    
    if(!arg[1]) {
      console.log(X);
      return;
    }
  
    const P = arg[1].split(" ").map(n=>parseInt(n));
    let cnt = 1;
    
    while(true) {
        if(P.indexOf(X) === -1) {
            console.log(X);
            return;
        }
      
        let answer1;
        let answer2;
      
        if(P.indexOf(X - cnt) === -1) {
            answer2 = X - cnt;
            console.log(answer2);
            return;
        }
        
        if(P.indexOf(X + cnt) === -1) {
            answer1 = X + cnt;
            console.log(answer1);
            return;
        }
       
      	cnt++;
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));