import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let xn = readInts()
    let exclusionInts = readInts()
    if exclusionInts.isEmpty ?? true{
        print(xn[0])
        return
    }
    var x = 0
    var y = 0
    for i in 1...100{
        x = xn[0] - i
        y = xn[0] + i
        
        if !exclusionInts.contains(x){
            print(x)
            return
        }
        if !exclusionInts.contains(y){
            print(y)
            return
        }
    }
    print(xn[0])
}

main()


