object Main {
  def main(args: Array[String]): Unit = {
    val Array( standard_num, nums ) = io.StdIn.readLine.split(" ").map{_.toInt}

    if( nums == 0 ) println( standard_num )
    else {
      val illegal_nums = io.StdIn.readLine.split(" ").map{_.toInt}
      val check_nums = ( -100 to 100 ).filter( !illegal_nums.contains( _ ) )
      var answer_num = 100000
      var min_value  = 100000

      check_nums.foreach{ i =>
        val check_value = Math.abs( standard_num - i )
        if( check_value < min_value ) {
          min_value = check_value
          answer_num = i
        }
      }

      println( answer_num )
    }
  }
}