import Foundation

let input1 = readLine()!.components(separatedBy: " ")
let x = Int(input1[0])!
let n = Int(input1[1])!

if n == 0 {
    print(x)
    exit(0)
}

var p = readLine()!.components(separatedBy: " ").map {Int($0)!}

var counter = 0
while(true) {
    
    if p.first(where: {$0 == x - counter}) == nil {
        print(x - counter)
        exit(0)
    }
    
    if p.first(where: {$0 == x + counter}) == nil {
        print(x + counter)
        exit(0)
    }
    
    counter += 1

}
