let input = readLine()!.split(separator: " ").map { Int($0)! }
let X = input[0]
let N = input[1]

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

var diff = 0

var result = X
while true {
    if !p.contains(X - diff) {
        result = X - diff
        break
    } else if !p.contains(X + diff) {
        result = X + diff
        break
    }
    diff += 1
}

print(result)
