import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = sc.nextInt()
  val n = sc.nextInt()
  val p = (1..n).map { sc.nextInt() }

  if (n == 0) {
    println(x)
    return
  }

  var index = x
  var diff = Integer.MAX_VALUE
  for (i in -1..101) {
    if (p.contains(i)) {
      continue
    }

    val tmp = Math.abs(x - i)
    if (tmp < diff) {
      diff = tmp
      index = i
    }
  }

  println(index)
}
