import java.util.Scanner

import scala.util.control.Breaks

object Main {

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val x = sc.nextInt()
    val n = sc.nextInt()

    val p = Set.fill(n)(sc.nextInt())

    var ans = x
    var dis = 0
    val b = new Breaks
    b.breakable {
      while (true) {
        if (!p.contains(ans - dis)) {
          ans = ans - dis
          b.break()
        } else if (!p.contains(ans + dis)) {
          ans = ans + dis
          b.break()
        } else {
          dis += 1
        }
      }
    }

    println(ans)

  }

}
