import Foundation
func readInts() -> [Int] {
    return readLine()!.components(separatedBy: " ").map { Int($0)! }
}

code_block: do {
    let x_n = readInts()
    if x_n[1] == 0 {
        print(x_n[0])
        break code_block
    }

    let p = readInts()
    let array = Array(0...100).filter { !p.contains($0) }
    var diff = [Int : Int]()

    for num in array {
        diff[num] = abs(num - x_n[0])
    }
    print(diff.min { left, right in
        return left.value != right.value
        ? left.value < right.value
        : left.key < right.key
        }!.key)
}
