object Main extends App {
  val flags = Array.ofDim[Boolean](102)

  @scala.annotation.tailrec
  def loop(low: Int, high: Int): Int =
    if (!flags(low)) low else if (!flags(high)) high else loop(low - 1, high + 1)

  val sc = new java.util.Scanner(System.in)
  val X, N = sc.nextInt()
  for (_ <- 1.to(N)) flags(sc.nextInt()) = true
  println(loop(X, X))
}
