fun main(args: Array<String>) {
	val (x, n) = readLine()!!.split(" ").map{it.toInt()}

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

  	val ns = readLine()!!.split(" ").map{it.toInt()}
	if (!ns.contains(x)) { 
      println(x)
      return
	}
  
  	var i = x + 1
  	var j = x - 1
  	while (true) {
    	if (!ns.contains(j)) {
        	println(j)
          	return
        } else if (!ns.contains(i)) {
        	println(i)
          	return
        } else {
        	i += 1
          	j -= 1
        }
    }
}