func readIntPair() -> (Int, Int) {
    let line = readLine()!.split(separator: " ").map({Int($0)!})
    return (line[0], line[1])
}

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


let (X, N) = readIntPair()
if N == 0 {
    print(X)
} else {
    let p = readIntArray()
    if !p.contains(X) {
        print(X)
    } else {
        var ans = 101
        (0...101).forEach({
            if !p.contains($0) {
                let temp = max(ans, X) - min(ans, X)
                let dist = max($0, X) - min($0, X)
                if dist < temp {
                    ans = $0
                } else if dist == temp {
                    ans = min(ans, $0)
                }
            }
        })
        print(ans)
    }
}
