object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val x, n = sc.nextInt()
  val ps = Set.fill(n)(sc.nextInt())
  val ans = (0 to 100).flatMap(i => List(x-i, x+i)).find{!ps.contains(_)}.get
  println(ans)
}
