import java.util.Scanner

import scala.io.StdIn._
object Main extends App {

  def read(): (Int, Array[Int]) = {
    val sc: Scanner = new Scanner(System.in)
    val x, n = sc.nextInt()
    val arr = Array.fill(n)(sc.nextInt)
    sc.close()
    (x, arr)
  }

  def solve(): Int = {
    val (x, arr) = read()
    (0 to 101).diff(arr.toSeq).map { num =>
      (num, (x - num).abs)
    }.minBy { case (num, diff) => (diff, num) }._1
  }

  println(solve())

}
