import Foundation
// Decimal型の有効桁数は38桁
let line = readLine()!.components(separatedBy: " ").map { Int($0)! }
let X = line[0]
let N = line[1]

var z = Array.init(repeating: 1000, count: 102)

guard N != 0 else {
    print(X)
    exit(EXIT_SUCCESS)
}

for i in 0...101 {
    z[i] = abs(X - i)
}

var p = readLine()!.components(separatedBy: " ").map { Int($0)! }

for j in 0..<N {
    z[p[j]] = 1000
}

let min = z.sorted().first!

for (i, v) in z.enumerated() {
    if v == min {
        print(i)
        exit(EXIT_SUCCESS)
    }
}
