import Foundation

let imput = readLine()!.components(separatedBy: " ").map{Int($0)!}
let X = imput[0]
let N = imput[1]
let num = readLine()!

if num == ""{
    print(X)
}else {
    let pNums = num.components(separatedBy: " ").map{Int($0)!}
    var nums = [0]
    var min = 100
    var minNum = 0
    
    
    
    for i in 1...101 {
        nums.append(i)
    }
    
    for i in 0...N - 1 {
        for j in 0...101 - N {
            if pNums[i] == nums[j] {
                nums.remove(at: j)
            }
        }
    }
    
    for i in (0...101 - N).reversed() {
        var a = abs(nums[i] - X)
        if min >= a {
            min = a
            minNum = nums[i]
        }
        
    }
    
    print(minNum)
}

