function main(lines) {
  const input = lines.split('\n')
  const X = input[0].split(' ')[0]-0
  const array = input[1].split(' ').map(Number)
    for(let i=1; i<101; i++){
        if(array[0] === 0){
        console.log(X)
        break
        }
        if(!array.includes(X-i)){
            console.log(X-i)
            break;
        } else if(!array.includes(X+i)){
            console.log(X+i)
            break;
        }
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

