import java.util.Scanner

fun main(args: Array<String>) {
  val cin = Scanner(System.`in`)
  val x = cin.nextInt()
  val n = cin.nextInt()
  val s = Array<Boolean>(105, {true})

  for (i in 0 until n) {
    val a = cin.nextInt()
    s[a] = false
  }

  for (i in 0..100) {
    if (x - i >= 0) {
      if (s[x - i]) {
        println(x - i)
        cin.close()
        return
      }
    }
    if (x + i <= 104) {
      if (s[x + i]) {
        println(x + i)
        cin.close()
        return
      }
    }
  }

  cin.close()
}