object Main extends App{
  import scala.io.StdIn._
  val Array(x,n) = readLine().split(" ").map(_.toInt)
  if(n == 0){
    println(x)
  } else {
    var p = readLine().split(" ").map(_.toInt).toSeq
    var u = (x to(101)).find(!p.contains(_)).get
    var d = (x - 1 to 0 by(-1)).find(!p.contains(_)).get
    val uD = u - x
    val dD = x - d
    val ans = if(dD <= uD) d else u
    println(ans)
  }
}
