import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

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

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func mainC() {
    let (X, N) = readTwoInts()
    let numbers = readInts()

    for i in 0...100 {
        let targetA = X - i

        if !numbers.contains(targetA) {
            print(targetA)
            return
        }

        let targetB = X + i
        if !numbers.contains(targetB) {
            print(targetB)
            return
        }
    }

}

mainC()