class Scanner {
    private var stack = [String]()
    private var index = 0
    
    func peek() -> String {
        if stack.count == index {
            stack += readLine()!.split(separator: " ").map{ String($0) }
        }
        return stack[index]
    }
    
    func next() -> String {
        let value = peek()
        index += 1
        return value
    }
    
    func nextInt() -> Int {
        return Int(next())!
    }
    
    func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()

let X = scanner.nextInt()
let N = scanner.nextInt()
let P = (0 ..< N).map { _ in scanner.nextInt() }

let answer = (-200 ... 200).filter {
    i in !P.contains(i)
}.min { (i, j) in
    (abs(X - i), i) < (abs(X - j), j)
}!

print(answer)
