import scala.io.StdIn._

object Main extends App {
  val Array(x, n) = readLine.split(" ").map(_.toInt)
  val p = readLine.split(" ").map(_.toInt).toSet

  val up = (x to 101).find(!p.contains(_)).get
  val down = (x - 1 to 1 by -1).find(!p.contains(_)).get

  val upDiff = up - x
  val downDiff = x - down

  val ans = if (downDiff <= upDiff) down else up

  println(ans)
}

