let inputs = readLine()!.split(separator: " ").map { Int($0)! }

let X = inputs[0]
let N = inputs[1]

if N == 0 {
  print(X)
} else {
	let banned = Set(readLine()!.split(separator: " ").map { Int($0)! })
  	var lessThan = X
  	var graterThan = X
  	for num in X...101 {
      if !banned.contains(num) {
        graterThan = num
        break
      }
    }
  	for num in (0...X).reversed() {
      if !banned.contains(num) {
        lessThan = num
        break
      }
    }
  	if (graterThan - X) * (graterThan - X) > (lessThan - X) * (lessThan - X) {
      print(lessThan)
    } else if (graterThan - X) * (graterThan - X) < (lessThan - X) * (lessThan - X) {
      print(graterThan)
    } else {
      print(lessThan)
    }
}