object Main extends App {
  val in = io.StdIn.readLine.split(' ').map(_.toInt)
  val x = in(0)
  val p = io.StdIn.readLine.split(' ').map(_.toInt)

  for(i <- 1 to x+1){
    if(!p.contains(x+i)) {
      println(x+i)
      sys.exit
    }
    if(!p.contains(x-i)) {
      println(x-i)
      sys.exit
    }  
  }
}