import Foundation
let main: () = {
    let (N, K) = *listOfInt()
    let A = listOfInt()
    var l = 0, r = 1000000001
    while r - l > 1 {
        let x = (l + r) / 2
        func f(_ x: Int) -> Bool {
            var now = 0
            for a in A { now += (a - 1) / x }
            return now <= K
        }
        if f(x) { r = x}
        else { l = x }
    }
    print(r)
}()

//----------------------------------

let dx = [1, 0, -1, 0] //[1, 0, -1, 0, -1,  1, -1, 1]
let dy = [0, 1, 0, -1] //[0, 1, 0, -1, -1, -1,  1, 1]

@inlinable func gcd(_ a: Int, _ b: Int) -> Int { (b > 0) ? gcd(b, a % b) : a }
@inlinable func lcm(_ a: Int, _ b: Int) -> Int { a / gcd(a, b) * b }

//----------------------------------

infix operator  =~ : ComparisonPrecedence
infix operator !=~ : ComparisonPrecedence
func =~ <T: FixedWidthInteger>(left: T, right: Range<T>) -> Bool { right ~= left }
func !=~ <T: FixedWidthInteger>(left: T, right: Range<T>) -> Bool { !(right ~= left) }
func =~ <T: FixedWidthInteger>(left: T, right: ClosedRange<T>) -> Bool { right ~= left }
func !=~ <T: FixedWidthInteger>(left: T, right: ClosedRange<T>) -> Bool { !(right ~= left) }

func =~ <T: Collection > (left: T.Element, right: T) -> Bool where T.Element : Equatable { right.contains(left) }
func !=~ <T: Collection > (left: T.Element, right: T) -> Bool where T.Element : Equatable { !right.contains(left) }

infix operator /^ : MultiplicationPrecedence
infix operator /^= : AssignmentPrecedence
func /^ <T: FixedWidthInteger>(left: T, right: T) -> T { (left + (right - 1)) / right }
func /^= <T: FixedWidthInteger>(left: inout T, right: T) { left = (left + (right - 1)) / right }

@inlinable func chmax<T: Comparable>(_ m: inout T, _ q: T) { if (m < q) { m = q } }
@inlinable func chmin<T: Comparable>(_ m: inout T, _ q: T) { if (m > q) { m = q } }
@inlinable func chRmax<T: Comparable>(_ m: inout T, _ q: T) -> Bool { if (m < q) { m = q; return true } else { return false } }
@inlinable func chRmin<T: Comparable>(_ m: inout T, _ q: T) -> Bool { if (m > q) { m = q; return true } else { return false } }

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) { (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T) { (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T) { (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T) { (a[0], a[1], a[2], a[3], a[4]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T, T) { (a[0], a[1], a[2], a[3], a[4], a[5]) }

func printErr(_ str: String, terminator: String = "\n") {
    let s = str + terminator
    FileHandle.standardError.write(s.data(using: .utf8)!)
    FileHandle.standardError.synchronizeFile()
}

@inlinable func next() -> String { readLine()! }
@inlinable func nextInt() -> Int { Int(next())! }
@inlinable func nextDouble() -> Double { Double(next())! }
@inlinable func listOfString() -> [String] { next().split(separator: " ").map(String.init) }
@inlinable func listOfInt() -> [Int] { listOfString().map { Int($0)! } }
@inlinable func listOfInt(_ offset: Int = 0) -> [Int] { listOfString().map { Int($0)! + offset } }
@inlinable func listOfInt(_ offsets: Int ...) -> [Int] { listOfString().enumerated().map { Int($0.element)! + offsets[$0.offset % offsets.count] } }
@inlinable func listOfDouble(_ offset: Double = 0.0) -> [Double] { listOfString().map { Double($0)! + offset } }
@inlinable func listOfDouble(_ offsets: Double ...) -> [Double] { listOfString().enumerated().map { Double($0.element)! + offsets[$0.offset % offsets.count] } }

extension Int {
    init(s: String) { self.init(s)! }
    var isEven: Bool { self.isMultiple(of: 2) }
    var isOdd: Bool { !self.isEven }
    var isTrue: Bool { self != 0 }
    var isFalse: Bool { !self.isTrue }
    var toString: String { String(self) }
    var toChar: Character { Character(UnicodeScalar(UInt8(self))) }
}
func + (left: Int, right: Bool) -> Int { left + (right ? 1 : 0) }
extension Character {
    var asciiCode: Int { Int(self.asciiValue!) }
    var string: String { String(self) }
}
extension String {
    @inlinable subscript (position: Int) -> Character { self[self.index(self.startIndex, offsetBy: position)] }
    @inlinable func repeate(_ times: Int) -> String { String(repeating: self, count: times) }
    //  @inlinable subscript (n: Int) -> String { String(self[self.index(self.startIndex, offsetBy: n)]) }
    //  @inlinable subscript (n: Int) -> Int { Int(self[self.index(self.startIndex, offsetBy: n)].asciiValue!) }
    var toInt: Int { Int(self)! }
}
extension String { // VB like
    @inlinable func _index(_ position: Int) -> String.Index! {
        if !(0 ..< self.count ~= position) { return nil }
        return self.index(self.startIndex, offsetBy: position)
    }
    @inlinable func mid(from index: Int, length: Int) -> String! {
        if let startPosition = self._index(index) {
            if let endPosition = self._index(index + length - 1) {
                return String(self[startPosition...endPosition])
            } else {
                let endPosition = self.index(before: self.endIndex)
                return String(self[startPosition...endPosition])
            }
        }
        return ""
    }
    @inlinable func left(_ length: Int) -> String { String(self.prefix(length)) }
    @inlinable func right(_ length: Int) -> String { String(self.suffix(length)) }
}

extension Dictionary {
    @inlinable mutating func getOrSet(_ key: Key, _ defaultValue: () -> Value) -> Value {
        if let stored = self[key] { return stored }
        else {
            let newValue = defaultValue()
            self[key] = newValue
            return newValue
        }
    }
    @inlinable mutating func getOrElse(_ key: Key, _ defaultValue: () -> Value) -> Value {
        if let stored = self[key] { return stored } else { return defaultValue() }
    }
    @inlinable func containsKey(_ key: Key) -> Bool { self.keys.contains(key) }
}

extension Set {
    static func += (left: inout Set<Element>, right: Element) { left.insert(right) }
    static func -= (left: inout Set<Element>, right: Element) { left.remove(right) }
}

extension Array {
    static func += (left: inout Array<Element>, right: Element) { left.append(right) }
    init(_ size: Int, _ initValue: ((Int) -> Element)) {
        self = [Element]()
        for index in 0 ..< size {
            let value = initValue(index)
            self.append(value)
        }
    }
    init(_ size: Int, _ initValue: (() -> Element)) {
        self = [Element]()
        for _ in 0 ..< size {
            let value = initValue()
            self.append(value)
        }
    }
}
typealias IntArray = Array<Int>
typealias DoubleArray = Array<Double>
typealias BoolArray = Array<Bool>
typealias StringArray = Array<String>

extension Array where Element == Int {
    init(_ size: Int) {
        self = [Element](repeating: 0, count: size)
    }
}
extension Array where Element == Double {
    init(_ size: Int) {
        self = [Element](repeating: 0.0, count: size)
    }
}
extension Array where Element == Bool {
    init(_ size: Int) {
        self = [Element](repeating: false, count: size)
    }
}
extension Array where Element == String {
    init(_ size: Int) {
        self = [Element](repeating: "", count: size)
    }
}

extension Array {
    @inlinable func count(_ predicate: ((Element) -> Bool)) -> Int {
        var cnt = 0; for e in self { if (predicate(e)) { cnt += 1 } }
        return cnt
    }
    @inlinable func groupBy<K>(_ keySelector: (Element) -> K) -> [K : [Element]] {
        var destination = [K : [Element]]()
        for element in self {
            let key = keySelector(element)
            var list = destination.getOrSet(key) { [Element]() }
            list.append(element)
            destination[key] = list
        }
        return destination
    }
    @inlinable func groupByIndexed<K>(_ keySelector: (Element) -> K) -> [K : [Int]] {
        var destination = [K : [Int]]()
        for element in self.enumerated() {
            let key = keySelector(element.element)
            var list = destination.getOrSet(key) { [Int]() }
            list.append(element.offset)
            destination[key] = list
        }
        return destination
    }
}

extension Array {
    func binarySearch(_ element: Element, by compare: (Element, Element) -> Int, fromIndex: Int = 0, toIndex: Int = -1) -> Int {
        var low = fromIndex
        var high = (toIndex == -1) ? self.count - 1 : toIndex - 1
        while (low <= high) {
            let mid = (low + high) >> 1 // safe from overflows
            let midVal = self[mid]
            let cmp = compare(midVal, element)
            if (cmp < 0) { low = mid + 1 }          //-1
            else if (0 < cmp) { high = mid - 1 }    // 1
            else { return mid } // key found        // 0
        }
        return -(low + 1)  // key not found
    }
}
extension Array where Element : Comparable {
    func binarySearch(_ element: Element, fromIndex: Int = 0, toIndex: Int = -1) -> Int {
        var low = fromIndex
        var high = (toIndex == -1) ? self.count - 1 : toIndex - 1
        while (low <= high) {
            let mid = (low + high) >> 1 // safe from overflows
            let midVal = self[mid]
            if (midVal < element) { low = mid + 1 }
            else if (midVal > element) { high = mid - 1 }
            else { return mid } // key found
        }
        return -(low + 1)  // key not found
    }
}

extension Array where Element == Int {
    @inlinable func distinct() -> [Element] {
        var set = Set<Element>(), ary = [Element]()
        for n in self.indices { if !set.contains(self[n]) { ary.append(self[n]); set.insert(self[n]) } }
        return ary
    }
    @inlinable func any(_ predicate: (Element) -> Bool) -> Bool {
        var any = false; for element in self { if predicate(element) { any = true } }
        return any
    }
    @inlinable func all(_ predicate: (Element) -> Bool) -> Bool {
        self.allSatisfy(predicate)
    }
    @inlinable func sum() -> Element { self.reduce(0, +) }
    @inlinable func sum(by predicate: (Element) -> Element) -> Element {
        var sum = 0; for e in self { sum += predicate(e) }
        return sum
    }
    @inlinable func joinToString(_ sepatator: String = " ") -> String { self.map { String($0) }.joined(separator: sepatator) }
}

extension Array where Element == Double {
    @inlinable func sum() -> Element { self.reduce(0.0, +) }
    @inlinable func sum(by predicate: (Element) -> Element) -> Element {
        var sum = 0.0; for e in self { sum += predicate(e) }
        return sum
    }
    @inlinable func joinToString(_ sepatator: String = " ") -> String { self.map { String($0) }.joined(separator: sepatator) }
}
extension Array where Element == String {
    @inlinable func toIntDouble() -> (Int, Double) { (Int(self[0])!, Double(self[1])!) }
    @inlinable func toIntString() -> (Int, String) { (Int(self[0])!, self[1]) }
    @inlinable func toIntIntString() -> (Int, Int, String) { (Int(self[0])!, Int(self[1])!, self[2]) }
}

@inlinable func block( _ action: () -> Void) {
    action()
}
@inlinable func repeate(_ times1: Int, _ action: () -> Void) {
    for _ in 0 ..< times1 { action() }
}
@inlinable func repeate(_ times1: Int, _ action: (Int) -> Void) {
    for index1 in 0 ..< times1 {
        action(index1)
    }
}
@inlinable func repeate(_ times1: Int, _ times2: Int, _ action: (Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            action(index1, index2)
        }
    }
}
@inlinable func repeate(_ times1: Int, _ times2: Int, _ times3: Int, _ action: (Int, Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            for index3 in 0 ..< times3 {
                action(index1, index2, index3)
            }
        }
    }
}
@inlinable func repeate(_ times1: Int, _ times2: Int, _ times3: Int, _ times4: Int, _ action: (Int, Int, Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            for index3 in 0 ..< times3 {
                for index4 in 0 ..< times4 {
                    action(index1, index2, index3, index4)
                }
            }
        }
    }
}

func measureTimeSeconds(block: (() -> Void)) -> Double {
    let startTime = Date()
    block()
    let duration = -startTime.timeIntervalSinceNow
    return duration
}


import Foundation

func splitCount(_ a: [Int], _ x: Int) -> Int {
  let res = a.reduce(0) { $0 + Int(ceil(Double($1) / Double(x))) - 1 }
  return res
}

let inp = readLine()!.split(separator: " ").map { Int($0)! }
let n = inp[0]
let k = inp[1]

let a = readLine()!.split(separator: " ").map { Int($0)! }

var left = 1
var right = a.max()!

var ans = right

while left <= right {
  let mid = left + (right - left) / 2
  let c = splitCount(a, mid)
  if c <= k {
    ans = min(ans, mid)
    right = mid - 1
  } else {
    left = mid + 1
  }
}
print(ans)


import Foundation

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

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

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) {return (a[0], a[1])}
prefix func * <T> (a: [T]) -> (T, T, T) {return (a[0], a[1], a[2])}

func ok(k: Int, a: [Int], v: Int) -> Bool {
    let m = a.lazy.map {
        Int((Double($0) / Double(v)).rounded(.up)) - 1
    }.reduce(0, +)

    return m <= k
}

func main() {
    let (n, k) = *readInts()
    let a = readInts()

    let ma = a.max()!

    var l = 1
    var r = ma
    while l < r {
        let mid = (l + r) / 2

        if ok(k: k, a: a, v: mid) {
            r = mid
        } else {
            l = mid + 1
        }
    }

    print(r)
}

main()


import Foundation

extension String {

    func toStrList() -> [String] {
        return self.map{String($0)}
    }

    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }

    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }

    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }

    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]

        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }

    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }

    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])

}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]

    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y

    return [rx, ry]
}
extension RandomAccessCollection {
    /// Finds such index N that predicate is true for all elements up to
    /// but not including the index N, and is false for all elements
    /// starting with index N.
    /// Behavior is undefined if there is no such N.
    func binarySearch(predicate: (Element) -> Bool) -> Index {
        var low = startIndex
        var high = endIndex
        while low != high {
            let mid = index(low, offsetBy: distance(from: low, to: high)/2)
            if predicate(self[mid]) {
                low = index(after: mid)
            } else {
                high = mid
            }
        }
        return low
    }
}

func e() -> Int {
    let NK = readLine()!.toSepIntList()
    let N = NK[0]
    let K = NK[1]
    var A = readLine()!.toSepIntList()
    var left = 1, right = 1000000001
    while (right-left) > 1 {
        let mid = (left + right) / 2
        func f(_ x: Int) -> Bool {
            var now = 0
            for a in A { now += (a - 1) / x }
            return now <= K
        }
        if f(mid) { right = mid }
        else { left = mid  }
    }
    return right
}

print(e())


import Foundation

extension String {

    func toStrList() -> [String] {
        return self.map{String($0)}
    }

    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }

    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }

    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }

    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]

        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }

    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }

    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])

}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]

    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y

    return [rx, ry]
}
extension RandomAccessCollection {
    /// Finds such index N that predicate is true for all elements up to
    /// but not including the index N, and is false for all elements
    /// starting with index N.
    /// Behavior is undefined if there is no such N.
    func binarySearch(predicate: (Element) -> Bool) -> Index {
        var low = startIndex
        var high = endIndex
        while low != high {
            let mid = index(low, offsetBy: distance(from: low, to: high)/2)
            if predicate(self[mid]) {
                low = index(after: mid)
            } else {
                high = mid
            }
        }
        return low
    }
}

func e() -> Int {
    let NK = readLine()!.toSepIntList()
    let N = NK[0]
    let K = NK[1]
    var A = readLine()!.toSepIntList()
    var left = 1
    var right = 1000000001
    var AC = [Int]()
    while (right-left) > 1 {
        let mid = (left + right) / 2
        var k = 0
        for a in A {
            k += ( a - 1 ) / mid
        }
        if k <= K {
            right = mid
        } else {
            left = mid
        }
    }
    return right
}

print(e())


import Foundation

extension String {

    func toStrList() -> [String] {
        return self.map{String($0)}
    }

    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }

    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }

    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }

    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]

        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }

    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }

    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])

}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]

    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y

    return [rx, ry]
}
extension RandomAccessCollection {
    /// Finds such index N that predicate is true for all elements up to
    /// but not including the index N, and is false for all elements
    /// starting with index N.
    /// Behavior is undefined if there is no such N.
    func binarySearch(predicate: (Element) -> Bool) -> Index {
        var low = startIndex
        var high = endIndex
        while low != high {
            let mid = index(low, offsetBy: distance(from: low, to: high)/2)
            if predicate(self[mid]) {
                low = index(after: mid)
            } else {
                high = mid
            }
        }
        return low
    }
}

func e() -> Int {
    let NK = readLine()!.toSepIntList()
    let N = NK[0]
    let K = NK[1]
    var A = readLine()!.toSepIntList()
    var left = 1
    var right = A.max()!
    var AC = [Int]()
    while (right-left) > 1 {
        let mid = (left + right) / 2
        var k = 0
        for a in A {
            k += ( a - 1 ) / mid
        }
        if k <= K {
            right = mid
        } else {
            left = mid
        }
    }
    return right
}

print(e())


import { readFileSync } from 'fs'

const LOG_MIN_SIZE = 1
const LOG_MAX_SIZE = 1e9

const binarySearch = (min: number, max: number, fn: (value: number) => boolean) => {
  let left = min
  let right = max

  while (left < right) {
    const middle = Math.floor((left + right) / 2)
    const result = fn(middle)

    if (result) {
      right = middle
    }
    else {
      left = middle + 1
    }
  }

  return left
}

function main(input: string) {
  const [n, k, ...logs] = input.split(/\s/).map(Number)

  const result = binarySearch(LOG_MIN_SIZE, LOG_MAX_SIZE, x => {
    // 各丸太の長さが`x`以下になるのに必要なカット回数
    const cuts = logs.reduce((sum, v) => sum + Math.ceil(v / x) - 1, 0)

    return cuts <= k
  })

  console.log(result)
}

main(readFileSync('/dev/stdin', 'utf8').trim())


// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [_N, K] = r.nn()
    const A = r.nn()

    const al = A.map(Math.log2)

    let lo = 0
    let hi = Math.log2(10 ** 9)
    let mid = 0

    // console.log(al)

    while (hi > lo) {
      mid = (hi + lo) / 2

      let sumK = 0

      al.forEach((ai) => {
        if (mid <= ai) {
          sumK += Math.ceil(ai - mid)
        }
      })
      // console.log(mid)
      // console.log(sumK)

      if (sumK === K && hi - lo < 0.001) {
        break
      }
      if (sumK > K) {
        lo = mid
      } else {
        hi = mid
      }
    }
    // console.log(mid)

    return Math.ceil(Math.pow(2, mid) - 0.00001)
  }

  const _io = (i = 0) => {
    const str: string = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}


import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
//const input = fs.readFileSync('./input.txt', 'utf8');

_f(input);

function _f(input: string) {
  const [_NK, _A] = input.split('\n');
  const [N, K] = _NK.split(' ').map((s) => parseInt(s));
  const A = _A.split(' ').map((s) => parseInt(s));

  const sum = A.reduce((p, c) => p + c, 0);

  console.log(Math.ceil(sum / (N + K)));
}


import sys
readline=sys.stdin.readline

X,N=map(int,readline().split())
P=set(list(map(int,readline().split())))

x = X
while x in P:
  x -= 1

minX = x

x = X
while x in P:
  x += 1
maxX = x

if abs(minX - X) <= abs(maxX - X):
  print(minX)
else:
  print(maxX)


X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    p = sorted(map(int, input().split()))
    nums = [num for num in range(102) if not num in p]
    A = [abs(num - X) for num in nums]
    print(nums[A.index(min(A))])


def main():
    x, n = list(map(int, input().split()))
    if n == 0:
        print(x)
        exit()
    else:
        P = list(map(int, input().split()))
    S = set(range(102)) - set(P)
    ans = float('inf')
    ans_p = 0
    for s in S:
        r = abs(s - x)
        if r < ans:
            ans = r
            ans_p = s
        elif r == ans:
            if ans_p > s:
                ans_p = s
    print(ans_p)
if __name__ == '__main__':
    main()


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, N = na()
p = na()
kouho = []
for i in range(-100, 101):
    if i in p:
        continue
    kouho.append((abs(X - i), i))
print(min(kouho)[1])


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, N = na()
p = na()
kouho = []
for i in range(1, 101):
    if i in p:
        continue
    kouho.append((abs(X - i), i))
print(min(kouho)[1])


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, N = na()
p = na()
res = inf
ans = inf
for i in range(1, 101):
    if i in p:
        continue
    kouho = abs(X - i)
    if res <= kouho:
        break
    else:
        res = kouho
        ans = i
print(ans)


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String args[]) throws Exception {
        String[] tokens = br.readLine().split(" ");
        int x = Integer.parseInt(tokens[0]);
        int n = Integer.parseInt(tokens[1]);
        Set<Integer> set = new HashSet<>();
        if(n>0){
            tokens = br.readLine().split(" ");
            for(int i=0;i<n;i++){
                set.add(Integer.parseInt(tokens[i]));
            }
        }
        int ans = x;
        for(int diff=0;diff<=Integer.MAX_VALUE;diff++){
            int left = x-diff;
            int right = x+diff;
            if(!set.contains(left)){
                ans = left;
                break;
            }
            if(!set.contains(right)){
                ans = right;
                break;
            }
        }
        System.out.println(ans);
    }

    private static class Pair{
        int first,second;

        public Pair(int first,int second){
            this.first = first;
            this.second = second;
        }

        public int hashCode(){
            return Objects.hash(first,second);
        }

        public boolean equals(Object obj){
            if(obj!=null || !(obj instanceof  Pair))
                return false;
            Pair pair = (Pair)obj;
            return pair.first == first && pair.second == second;
        }
    }

}


import java.io.*;import java.util.*;import java.math.*;
public class Main
{
	static long mod=1000000007l;
    static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE;
    static long maxl=Long.MAX_VALUE,minl=Long.MIN_VALUE;
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;

    static public void main(String[] args)throws Exception
    {
    	st=new StringTokenizer(br.readLine());
    	int X=i();
    	int n=i();
    	HashSet<Integer> h=new HashSet<>();
    	for(int x=0;x<n;x++)h.add(i());
    	if(!h.contains(X))pl(X);
    	else
    	{
    		for(int x=1;x<=300;x++)
    		{
    			if(!h.contains(X-x))
    			{
    				pl(X-x);
    				System.exit(0);
    			}
    			if(!h.contains(X+x))
    			{
    				pl(X+x);
    				System.exit(0);
    			}
    		}
    	}
    }

    static int max(int a,int b){return a>b?a:b;}
    static int min(int a,int b){return a<b?a:b;}
    static int abs(int a){return Math.abs(a);}
    static long max(long a,long b){return a>b?a:b;}
    static long min(long a,long b){return a<b?a:b;}
    static long abs(long a){return Math.abs(a);}
    static int sq(int a){return (int)Math.sqrt(a);}
    static long sq(long a){return (long)Math.sqrt(a);}
    static int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
//    static void g(int i)
//    {
//    	for(int e:ar[i])
//    	{
//    		if(e==i)continue;
//    		al[i].add(e);
//    		g(e);
//    	}
//    }
    static int ncr(int n,int c,long m)
    {
        long a=1l;
        for(int x=n-c+1;x<=n;x++)a=((a*x)%m);
        long b=1l;
        for(int x=2;x<=c;x++)b=((b*x)%m);
        return (int)((a*(div((int)b,m-2,m)%m))%m);
    }
    static int fib(int n){return (int)Math.round(Math.pow((1+sq(5))/2,n)/sq(5));}
    static boolean[] sieve(int n)
    {
        boolean bo[]=new boolean[n+1];
        bo[0]=true;bo[1]=true;
        for(int x=4;x<=n;x+=2)bo[x]=true;
        for(int x=3;x*x<=n;x+=2)if(!bo[x])for(int y=x*x;y<=n;y+=x)bo[y]=true;
        return bo;
    }
    static int[] fac(int n)
    {
        int bo[]=new int[n+1];
        for(int x=1;x<=n;x++)for(int y=x;y<=n;y+=x)bo[y]++;
        return bo;
    }
    static long div(long a,long b,long m)
    {
        long r=1l;
        a%=m;
        while(b>0)
        {
            if((b&1)==1)r=(r*a)%m;
            b>>=1;
            a=(a*a)%m;
        }
        return r;
    }
    static int i()throws IOException
    {
        if(!st.hasMoreTokens()) st=new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    static double d()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return Double.parseDouble(st.nextToken());
    }
    static void p(Object p){System.out.print(p);}
    static void p(String p){System.out.print(p);}
    static void p(int p){System.out.print(p);}
    static void p(double p){System.out.print(p);}
    static void p(long p){System.out.print(p);}
    static void p(char p){System.out.print(p);}
    static void p(boolean p){System.out.print(p);}
    static void pl(Object p){System.out.println(p);}
    static void pl(String p){System.out.println(p);}
    static void pl(int p){System.out.println(p);}
    static void pl(char p){System.out.println(p);}
    static void pl(double p){System.out.println(p);}
    static void pl(long p){System.out.println(p);}
    static void pl(boolean p){System.out.println(p);}
    static void pl(){System.out.println();}
    static int[] ari(int n)throws IOException
    {
        int ar[]=new int[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=Integer.parseInt(st.nextToken());
        return ar;
    }
    static int[][] ari(int n,int m)throws IOException
    {
        int ar[][]=new int[n][m];
        for(int x=0;x<n;x++)
        {
        	if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Integer.parseInt(st.nextToken());
        }
        return ar;
    }
    static long[] arl(int n)throws IOException
    {
        long ar[]=new long[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++) ar[x]=Long.parseLong(st.nextToken());
        return ar;
    }
    static long[][] arl(int n,int m)throws IOException
    {
        long ar[][]=new long[n][m];
        for(int x=0;x<n;x++)
        {
        	if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Long.parseLong(st.nextToken());
        }
        return ar;
    }
    static String[] ars(int n)throws IOException
    {
        String ar[]=new String[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++) ar[x]=st.nextToken();
        return ar;
    }
    static double[] ard(int n)throws IOException
    {
        double ar[]=new double[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=Double.parseDouble(st.nextToken());
        return ar;
    }
    static double[][] ard(int n,int m)throws IOException
    {
        double ar[][]=new double[n][m];
        for(int x=0;x<n;x++)
        {
        	if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Double.parseDouble(st.nextToken());
        }
        return ar;
    }
    static char[] arc(int n)throws IOException
    {
        char ar[]=new char[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=st.nextToken().charAt(0);
        return ar;
    }
    static char[][] arc(int n,int m)throws IOException
    {
        char ar[][]=new char[n][m];
        for(int x=0;x<n;x++)
        {
            String s=br.readLine();
            for(int y=0;y<m;y++)ar[x][y]=s.charAt(y);
        }
        return ar;
    }
    static void p(int ar[])
    {
        StringBuilder sb=new StringBuilder(11*ar.length);
        for(int a:ar)
        {
        	sb.append(a);
        	sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(int ar[][])
    {
        StringBuilder sb;
        for(int a[]:ar)
        {
            sb=new StringBuilder(2*a.length);
            for(int aa:a)
            {
            	sb.append(aa);
            	sb.append(' ');
            }
            System.out.println(sb);
        }
    }
    static void p(long ar[])
    {
        StringBuilder sb=new StringBuilder(20*ar.length);
        for(long a:ar)
        {
        	sb.append(a);
        	sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(long ar[][])
    {
        StringBuilder sb;
        for(long a[]:ar)
        {
            sb=new StringBuilder(2*a.length);
            for(long aa:a)
            {
            	sb.append(aa);
            	sb.append(' ');
            }
            System.out.println(sb);
        }
    }
    static void p(String ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(String a:ar)
        {
        	sb.append(a);
        	sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(double ar[])
    {
        StringBuilder sb=new StringBuilder(20*ar.length);
        for(double a:ar)
        {
        	sb.append(a);
        	sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(double ar[][])
    {
        StringBuilder sb;
        for(double a[]:ar)
        {
            sb=new StringBuilder(4*a.length);
            for(double aa:a)
            {
            	sb.append(aa);
            	sb.append(' ');
            }
            System.out.println(sb);
        }
    }
    static void p(char ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(char aa:ar)
        {
        	sb.append(aa);
        	sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(char ar[][])
    {
        StringBuilder sb;
        for(char a[]:ar)
        {
            sb=new StringBuilder(2*a.length);
            for(char aa:a)
            {
            	sb.append(aa);
            	sb.append(' ');
            }
            System.out.println(sb);
        }
    }
}


/*****Author: Satyajeet Singh, Delhi Technological University************************************/
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.lang.*;
    import java.math.*;
public class Main{
/*********************************************Constants******************************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins***************************************/
    public static void main(String args[]) throws Exception{
        int x=pi();
        int n=pi();
        int diff=Integer.MAX_VALUE;
        int ans=Integer.MAX_VALUE;
        boolean vis[]=new boolean[1001];
        for(int i=0;i<n;i++){
            vis[pi()]=true;
        }
        for(int i=-1000;i<=1000;i++){
            if(i>=0&&vis[i])continue;
            int d=Math.abs(i-x);
            if(d<diff){
                ans=i;
                diff=d;
            }
        }
        out.println(ans);
/****************************************Solution Ends**************************************************/
        out.flush();
        out.close();
    }
/****************************************Template Begins************************************************/
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing**********************************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.0000000000");
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation**************************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph*********************************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }
/*********************************************PAIR********************************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair*******************************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG***********************************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION***********************************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD**********************************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y;
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
}


import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }

        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 100;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }

        System.out.println(z);
    }
}


import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 0 ;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = 1; i <= 100;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }

        System.out.println(z);
    }
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        boolean[] q = new boolean[101];
        for(int i=0; i<N; i++){
            p[i]=sc.nextInt();
            q[p[i]] = true;
        }

        int res=X;
        for(int i=0; i<X+1; i++){
            if(!q[X-i]){
                res=X-i;
                System.out.println(res);
                return;
            }
            if(!q[X+i]){
                res=X+i;
                System.out.println(res);
                return;
            }
        }

        System.out.println(-1);

        }
    }


#include<cstdio>
using namespace std;
int a[105];
int main()
{
	int x,n,q;
	scanf("%d%d",&x,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&q);
		a[q]=1;
	}
	if(a[x]!=1)
	{
		printf("%d\n",x);
		return 0;
	}
	for(int i=1;i<=101;i++)
	{
		int l=x-i;
		int r=x+i;
		if(a[l]==0)
		{
			printf("%d\n",l);
			return 0;
		}
		if(a[r]==0)
		{
			printf("%d\n",r);
			return 0;
		}
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int vis[110];
int main(){
	int x,n,i,a,l,r;
	scanf("%d%d",&x,&n);
	if(n==0){printf("%d\n",x);return 0;}
	for(i=1;i<=n;i++)scanf("%d",&a),vis[a]=1;
	if(!vis[x]){printf("%d\n",x);return 0;}
	l=r=x;
	while(1){
		l--,r++;
		if(!vis[l]){printf("%d\n",l);break;}
		if(!vis[r]){printf("%d\n",r);break;}
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int x,n,s,f;
int p[105];
int main(){
	scanf("%d%d",&x,&n);
	for(int i=1;i<=n;++i){
		scanf("%d",p+i);
	}
	p[n+1]=100001;
	p[0]=-100001;
	sort(p+1,p+1+n);
	for(int i=0;i<=n;++i){
		if(p[i]<=x&&x<p[i+1]){
			s=i;
			f=i+1;
			break;
		}
	}
	for(int i=0;i<=1000;++i){
		if(p[s]!=x-i){
			printf("%d\n",x-i);
			return 0;
		}
		else s--;
		if(i==0)continue;
		if(p[f]!=x+i){
			printf("%d\n",x+i);
			return 0;
		}
		else f++;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
# define LL long long

int main(){
    int p[101]={0};
    int x,n;
    scanf("%d%d",&x,&n);
    for (int i=0;i<n;i++){
        int y;
        scanf("%d",&y);
        p[y]+=1;
    }
    int i=x,j=x,ans;
    while (1){
        if (p[i]==0){
            ans=i;
            break;
        }
        if (p[j]==0){
            ans=j;
            break;
        }
        else{
            i-=1;
            j+=1;
        }
    }
    printf("%d",ans);
}


#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const ll INF=1e17;
const long double PI=acos(-1);

ll po(int x){
    if(x==0){
        return 1;
    }
    ll ret=1;
    for(int i=0;i<x;i++){
        ret=(ret%MOD * 10)%MOD;
    }
    return ret;
}
bool a[200];

void solve(int T){
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x;
        return;
    }
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        a[r]=true;
    }
    int mn=102,ans=102;
    for(int i=1;i<=101;i++){
        if(a[i]==false){
            if(abs(x-i)<mn){
                ans=i;
                mn=abs(x-i);
            }
        }
    }
    cout<<ans<<"\n";
}

int main() {
    fastio
    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}
/*

for(int i=1;i<n;i++){
        for(int j=1;j<n;j++){
            cout<<i<<" "<<j<<" "<<n-(i*j)<<"\n";
        }
    }
    */


#include<bits/stdc++.h>
#include<vector>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    int x, n;
    cin >> x >> n;
    int p[n];

    //solve
    int stock[101];
    int ans1, ans2;
    for(int i=0; i<n; i++){
        cin >> p[i];
        stock[p[i]] = 1;
    }
    for(int i = x; i < 100; i++){
        if(stock[i+1] == 0){
            ans1 = abs(i+1-x);
            break;
        }
    }
    for(int i = x; i>0; i--){
        if(stock[i-1] == 0){
            ans2 = abs(i-1-x);
            break;
        }
    }
    ans1 = min(ans1, ans2);

    cout << ans1 <<endl;

    return 0;
}


#include<stdio.h>
signed main(){
    int x,n,p[105];
    scanf("%d %d",&x,&n);
    int i;
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
    }
    int flag[105]={};
    int ans=0;
    for(i=0;i<n;i++){
        flag[p[i]]=1;
    }
    for(i=1;i<=101;i++){
        if(flag[i]==0){
            int abs1,abs2;
            abs1=x-ans;
            abs2=x-i;
            if(abs1<0){
                abs1=abs1*-1;
            }
            if(abs2<0){
                abs2=abs2*-1;
            }
            if(abs1>abs2){
                ans=i;
            }
        }
    }
    printf("%d\n",ans);
    return(0);
}


#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
#define pai 3.1415926535897932384626433832795028841971693

int main(){
  int x,n,min=100001,ans=0,k;
  scanf("%d %d",&x,&n);
  int p[n],a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&p[i]);
  }

  for(int i=-1;i<201;i++){
    for(int j=0;j<n;j++){
      if(i==p[j]){
        k=1;
        break;
      }
      k=0;
    }
    if(k==1){
      continue;
    }
    else{
      if(min>abs(x-i)){
        min=abs(x-i);
        ans=i;
      }
      else if(min==abs(x-i)){
        if(ans>i){
          ans=i;
        }
      }
    }
  }
  printf("%d",ans);
   return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main(void){

    int x,n;

    scanf("%d %d",&x,&n);
    // printf("%d %d",x,n);
    if (n==0){
        printf("%d\n",x);
        return 0;
    }

    int p[n];
    int min=0;
    int ans=0;
    int flag=0;

    for (int i=0;i<n;i++){
        scanf("%d",&p[i]);
        if (x==p[i])
            flag=1;
    }

    if (flag==0){
        printf("%d\n",x);
        return 0;
    }

    for (int i=1;i<100;i++){
        int flag1=0;
        int flag2=0;
        for (int j=0;j<n;j++){
            if (x-i==p[j])
                flag1=1;
            else if (x+i==p[j])
                flag2=1;
        }
        // printf("i=%d flag1=%d flag2=%d\n",i,flag1,flag2);
        if ((flag1==0 && flag2==0) || (flag1==0 && flag2==1)){
            printf("%d\n",x-i);
            break;
        }else if (flag1==1 && flag2==0){
            printf("%d\n",x+i);
            break;
        }

    }

    return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main(){
        int i, x, n, left=103, right=103;
        scanf("%d %d", &x, &n);

        if(n==0){
                printf("%d", x);
                return 0;
        }

        int p[101]={0};
        int pp;

        for(i=0; i<n; i++){
                scanf("%d", &pp);
                p[pp]=1;
        }

        int count=0;

        for(i=0; i<101; i++){
                if(p[x+i]!=1){
                        right=x+i;
                        count++;
                }
                if(p[x-i]!=1){
                        left=x-i;
                        count++;
                }

                if((count!=0)&&(left>right)){
                        printf("%d", right);
                        return 0;
                }else if((count!=0)&&(right>left)){
                        printf("%d", left);
                        return 0;
                }

        }

        return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main(){
        int i, x, n, left=103, right=103;
        scanf("%d %d", &x, &n);

        if(n==0){
                printf("%d", x);
                return 0;
        }

        int p[101]={0};
        int pp;

        for(i=0; i<n; i++){
                scanf("%d", &pp);
                p[pp]=1;
        }

        int count=0;

        for(i=1; i<101; i++){
                if(p[x+i]!=1){
                        right=x+i;
                        count++;
                }
                if(p[x-i]!=1){
                        left=x-i;
                        count++;
                }

                if((count!=0)&&(left>right)){
                        printf("%d", right);
                        return 0;
                }else if((count!=0)&&(right>left)){
                        printf("%d", left);
                        return 0;
                }

        }

        return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void){
    int X, N, i, j, k, min=100, min_index=0, flag=0;
    scanf("%d%d", &X, &N);
    int p[N+1], b[101];
    for(i=1; i<=N; i++){
        scanf("%d", &p[i]);
        b[i]=0;
    }
    for(i=0; i<=N; i++){
        b[p[i]]=1;
    }
    for(i=0; i<=101; i++){
        if(N==0){
            printf("%d", X);
            flag=1;
            break;
        }else if(min>abs(X-i) && b[i]==0 && min_index<=i){
            min = abs(X-i);
            min_index=i;
        }
    }

    if(flag==0){
        printf("%d", min_index);
    }

    return 0;
}


const main = (input) => {
  const args = input.trim().split("\n");
  const [x, n] = args[0]
    .trim()
    .split(" ")
    .map((n) => parseInt(n, 10));

  const excluded = (() => {
    if (n === 0) {
      return [];
    } else {
      return args[1]
        .trim()
        .split(" ")
        .map((n) => parseInt(n, 10));
    }
  })();

  const selection = [...Array(101 + 1).keys()].filter(
    (s) => !excluded.includes(s)
  );

  const abs = (n) => {
    if (n < 0) return -n;
    else {
      return n;
    }
  };
  const byAsc = (a, b) => a[1] - b[1];

  const answer = selection
    .map((s) => [s, abs(x - s)])
    .sort(byAsc)[0][0];

  console.log(answer);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    let X = parseInt(arg[0].split(" ")[0]);
    const N = parseInt(arg[0].split(" ")[1]);

    if(!arg[1]) {
      console.log(X);
      return;
    }

    const P = arg[1].split(" ").map(n=>parseInt(n));
    let cnt = 1;

    while(true) {
        if(P.indexOf(X) === -1) {
            console.log(X);
            return;
        }

        let answer1;
        let answer2;

        if(P.indexOf(X - cnt) === -1) {
            answer2 = X - cnt;
            console.log(answer2);
            return;
        }

        if(P.indexOf(X + cnt) === -1) {
            answer1 = X + cnt;
            console.log(answer1);
            return;
        }

      	cnt++;
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const rows = input.split('\n')
    const [X, N] = rows[0].split(' ').map(n => n - 0)
    const P = rows[1].split(' ').map(n => n - 0)

    for (let i = 0; i < 52; i++) {
        if (P.indexOf(X - i) === -1) {
            console.log(X - i)
            break
        }
        if (P.indexOf(X + i) === -1) {
            console.log(X + i)
            break
        }
    }

})(input)


const main = (input) => {
  input = input.trim().split('\n')

  const [x,] = input[0].split(' ').map(Number)
  if (input.length === 1) return console.log(x)
  const arr = input[1].split(' ').map(Number).sort((a, b) => a - b)

  for (let abs = 1; 'infinite'; abs++) {
    if (!arr.includes(x - abs)) return console.log(x - abs)
    if (!arr.includes(x + abs)) return console.log(x + abs)
  }
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))


function Main(input) {
  input=input.split("\n");
  const X=input[0].split(' ')[0]-0;
  const N=input[0].split(' ')[1]-0;

  var array=input[1].split(' ').map(e=>{
    return e-0;
  }).sort((a,b)=>{
    return Math.abs(a-X)-Math.abs(b-X)||a-b;
  });
  var counter=0;
  while(counter<array.length){
    if(Math.abs(array[counter]-X)!==Math.floor((counter+1)/2)){
      console.log(counter%2===0?X+Math.floor((counter+1)/2):X-Math.floor((counter+1)/2));
      return;
    }
    counter++;
  }
  counter--;
  console.log(N%2===0?X+Math.floor((counter+1)/2):X-Math.floor((counter+1)/2)-1);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict'

const main = (INPUT) => {
  const [X, N] = INPUT.split('\n')[0].split(' ').map(n => Number(n))
  const p = INPUT.split('\n')[1].split(' ').map(n => Number(n))
  if (N == 0) {
    console.log(X)
    return
  }
  let i = 1
  while (true) {
    if (!p.includes(X - i)) {
      console.log(X - i)
      return
    }
    if (!p.includes(X + i)) {
      console.log(X + i)
      return
    }
    i++
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func arrayContains(arr []int, num int) bool {
	for _, v := range arr {
		if v == num {
			return true
		}
	}
	return false
}

func main() {
	var x, n int
	var pt []string
	var p []int
	fmt.Scan(&x, &n)

	if n == 0 {
		fmt.Print(x)
		return
	}

	sc := bufio.NewScanner(os.Stdin)

	if sc.Scan() {
		pt = strings.Split(sc.Text(), " ")
	}

	for _, e := range pt {
		num, _ := strconv.Atoi(e)
		p = append(p, num)
	}

	i := 1
	current := x
	for {
		if !arrayContains(p, current) {
			fmt.Print(current)
			return
		}

		if current == x {
			current = x - 1
			continue
		}
		if current < x {
			current = x + i
		} else {
			i += 1
			current = x - i
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, n int
	fmt.Scanf("%d %d", &x, &n)

	sc.Split(bufio.ScanWords)

	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	for i:=0; i < 100; i++ {
		if !contains(a, x-i) {
			fmt.Println(x-i)
			return
		}
		if !contains(a, x+i) {
			fmt.Println(x+i)
			return
		}
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func contains(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"math"
)

var sc = bufio.NewScanner(os.Stdin)

// 1行読み込み
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 読み込みをint型へキャスト
func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if(err != nil) {
		panic(err)
	}
	return num
}

// 読み込みをfloat型へキャスト
func nextFloat() float64 {
	sc.Scan()
	num, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return num
}

func main() {
	// scannerの挙動を改行区切り → 空白区切りに変更
	sc.Split(bufio.ScanWords)
	x := nextInt()
	n := nextInt()
	p_list := make([]int, 0, n)
	if n == 0 {
		fmt.Println(x)
		return
	}
	for i := 0; i < n; i++ {
		p_list = append(p_list, nextInt())
	}
	p_check := make([]int, 200, 200)
	// p_check[x - 1]++
	for _, i := range p_list {
		p_check[i - 1]++
	}

	x_next := x
	x_befo := x
	for i := x; i < 1000; i++ {
		if p_check[i - 1] == 0 {
			x_next = i
			break
		}
	}
	for i := x; i > -1000; i-- {
		if i == 0 {
			x_befo = i
			break
		}
		if p_check[i - 1] == 0 {
			x_befo = i
			break
		}
	}
	next_abs := int(math.Abs(float64(x_next - x)))
	befo_abs := int(math.Abs(float64(x_befo - x)))

	if next_abs == befo_abs {
		fmt.Println(x_befo)
	} else if next_abs > befo_abs {
		fmt.Println(x_befo)
	} else {
		fmt.Println(x_next)
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var x, n int
	fmt.Fscan(r, &x, &n)

	if n == 0 {
		fmt.Fprintln(w, x)
		return
	}

	smallerList := NewSinglyLinkedList()
	biggerLiet := NewSinglyLinkedList()
	for i := 0; i < n; i++ {
		var p int
		fmt.Fscan(r, &p)
		if p < x {
			smallerList.Add(p)
		} else if p > x {
			biggerLiet.Add(p)
		}
	}

	var result int

	for smallerRes, biggerRes := x-1, x+1; ; smallerRes, biggerRes = smallerRes-1, biggerRes+1 {
		if !smallerList.Contains(smallerRes) {
			result = smallerRes
			break
		}
		if !biggerLiet.Contains(biggerRes) {
			result = biggerRes
			break
		}
	}

	fmt.Fprintln(w, result)

}

/* --- singlylinkedlist --- */

type SllValue = interface{}

type SinglyLinkedList struct {
	first *sllElement
	last  *sllElement
	size  int
}

type sllElement struct {
	value SllValue
	next  *sllElement
}

func NewSinglyLinkedList(values ...SllValue) *SinglyLinkedList {
	sll := &SinglyLinkedList{}
	if len(values) > 0 {
		sll.Add(values...)
	}
	return sll
}

func (sll *SinglyLinkedList) Add(values ...SllValue) {
	for _, value := range values {
		newElement := &sllElement{value: value}
		if sll.size == 0 {
			sll.first = newElement
			sll.last = newElement
		} else {
			sll.last.next = newElement
			sll.last = newElement
		}
		sll.size++
	}
}

func (sll *SinglyLinkedList) Prepend(values ...SllValue) {
	for v := len(values) - 1; v >= 0; v-- {
		newElement := &sllElement{value: values[v], next: sll.first}
		sll.first = newElement
		if sll.size == 0 {
			sll.last = newElement
		}
		sll.size++
	}
}

func (sll *SinglyLinkedList) Get(index int) (SllValue, bool) {
	if !sll.withinRange(index) {
		return nil, false
	}

	element := sll.first
	for e := 0; e != index; e, element = e+1, element.next {
	}

	return element.value, true
}

func (sll *SinglyLinkedList) Remove(index int) {
	if !sll.withinRange(index) {
		return
	}

	if sll.size == 1 {
		sll.Clear()
		return
	}

	var beforeElement *sllElement
	element := sll.first
	for e := 0; e != index; e, element = e+1, element.next {
		beforeElement = element
	}

	if element == sll.first {
		sll.first = element.next
	}
	if element == sll.last {
		sll.last = beforeElement
	}
	if beforeElement != nil {
		beforeElement.next = element.next
	}

	element = nil
	sll.size--
}

func (sll *SinglyLinkedList) Contains(values ...SllValue) bool {
	if len(values) == 0 {
		return true
	}
	if sll.size == 0 {
		return false
	}
	for _, value := range values {
		found := false
		for element := sll.first; element != nil; element = element.next {
			if element.value == value {
				found = true
				break
			}
		}
		if !found {
			return false
		}
	}
	return true
}

func (sll *SinglyLinkedList) Values() []SllValue {
	values := make([]SllValue, sll.size, sll.size)
	for e, element := 0, sll.first; element != nil; e, element = e+1, element.next {
		values[e] = element.value
	}
	return values
}

func (sll *SinglyLinkedList) IndexOf(value SllValue) int {
	if sll.size == 0 {
		return -1
	}
	for index, element := range sll.Values() {
		if element == value {
			return index
		}
	}
	return -1
}

func (sll *SinglyLinkedList) Empty() bool {
	return sll.size == 0
}

func (sll *SinglyLinkedList) Size() int {
	return sll.size
}

func (sll *SinglyLinkedList) Clear() {
	sll.size = 0
	sll.first = nil
	sll.last = nil
}

func (sll *SinglyLinkedList) Sort(comparator func(a, b interface{}) int) {
	if sll.size < 2 {
		return
	}

	values := sll.Values()
	UtilSort(values, comparator)

	sll.Clear()
	sll.Add(values...)
}

func (sll *SinglyLinkedList) Swap(i, j int) {
	if sll.withinRange(i) && sll.withinRange(j) && i != j {
		var element1, element2 *sllElement
		for e, currentElement := 0, sll.first; element1 == nil || element2 == nil; e, currentElement = e+1, currentElement.next {
			switch e {
			case i:
				element1 = currentElement
			case j:
				element2 = currentElement
			}
		}
		element1.value, element2.value = element2.value, element1.value
	}
}

func (sll *SinglyLinkedList) Insert(index int, values ...interface{}) {

	if !sll.withinRange(index) {
		if index == sll.size {
			sll.Add(values...)
		}
		return
	}

	sll.size += len(values)

	var beforeElement *sllElement
	foundElement := sll.first
	for e := 0; e != index; e, foundElement = e+1, foundElement.next {
		beforeElement = foundElement
	}

	if foundElement == sll.first {
		oldNextElement := sll.first
		for i, value := range values {
			newElement := &sllElement{value: value}
			if i == 0 {
				sll.first = newElement
			} else {
				beforeElement.next = newElement
			}
			beforeElement = newElement
		}
		beforeElement.next = oldNextElement
	} else {
		oldNextElement := beforeElement.next
		for _, value := range values {
			newElement := &sllElement{value: value}
			beforeElement.next = newElement
			beforeElement = newElement
		}
		beforeElement.next = oldNextElement
	}
}

func (sll *SinglyLinkedList) Set(index int, value SllValue) {
	if !sll.withinRange(index) {
		if index == sll.size {
			sll.Add(value)
		}
		return
	}

	foundElement := sll.first
	for e := 0; e != index; {
		e, foundElement = e+1, foundElement.next
	}
	foundElement.value = value
}

func (sll *SinglyLinkedList) String() string {
	str := "SinglyLinkedList\n"
	values := []string{}
	for element := sll.first; element != nil; element = element.next {
		values = append(values, fmt.Sprintf("%v", element.value))
	}
	str += strings.Join(values, ", ")
	return str
}

func (sll *SinglyLinkedList) withinRange(index int) bool {
	return index >= 0 && index < sll.size
}

/*--- sort ---*/

func UtilSort(values []interface{}, comparator func(a, b interface{}) int) {
	sort.Sort(utilSortable{values: values, comparator: comparator})
}

type utilSortable struct {
	values     []interface{}
	comparator func(a, b interface{}) int
}

func (s utilSortable) Len() int {
	return len(s.values)
}
func (s utilSortable) Swap(i, j int) {
	s.values[i], s.values[j] = s.values[j], s.values[i]
}
func (s utilSortable) Less(i, j int) bool {
	return s.comparator(s.values[i], s.values[j]) < 0
}

/* --- singlylinkedlist iterator --- */

type SllIterator struct {
	list    *SinglyLinkedList
	index   int
	element *sllElement
}

func (list *SinglyLinkedList) Iterator() SllIterator {
	return SllIterator{list: list, index: -1, element: nil}
}

func (iterator *SllIterator) Next() bool {
	if iterator.index < iterator.list.size {
		iterator.index++
	}
	if !iterator.list.withinRange(iterator.index) {
		iterator.element = nil
		return false
	}
	if iterator.index == 0 {
		iterator.element = iterator.list.first
	} else {
		iterator.element = iterator.element.next
	}
	return true
}

func (iterator *SllIterator) Value() interface{} {
	return iterator.element.value
}

func (iterator *SllIterator) Index() int {
	return iterator.index
}

func (iterator *SllIterator) Begin() {
	iterator.index = -1
	iterator.element = nil
}

func (iterator *SllIterator) First() bool {
	iterator.Begin()
	return iterator.Next()
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var X, n, p int
	var P [101]int
	var tmp float64
	tmp = 100000
	ans := 0

	fmt.Scan(&X, &n)

	for i := 0; i < n; i++ {
		fmt.Scan(&p)
		P[p] = 1
	}

	for i := 0; i < 101; i++ {
		if P[i] == 0 {
			if float64(tmp) > math.Abs(float64(X - i)) {
				ans = i
				tmp = math.Abs(float64(X - i))
			}
		}
	}
	fmt.Println(ans)
}


package main

import (
	"fmt"
)

func main() {
	//存在するものが1になる
	a := make([]int, 100)

	var x, n int
	fmt.Scanf("%d", &x)
	fmt.Scanf("%d", &n)

	var p int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &p)
		a[p - 1] = 1
	}

	if n == 0 {
		fmt.Println(x)
	}else{
		i := 0
		for {
			c := x - 1 - i
			if c > -1 && a[c] == 0 {
				fmt.Println(c + 1)
				break;
			}

			c = x - 1 + i
			if c < 100 && a[c] == 0 {
				fmt.Println(c + 1)
				break;
			}

			i = i + 1
		}
	}
}


x, n = gets.split.map(&:to_i)
if n==0
  p x
  exit
end
p = gets.split.map(&:to_i)
if !p.include?(x)
  p x
  exit
end
100.times{|i|
  if !p.include?(x-i)
    p x-i
    exit
  end
  if !p.include?(x+i)
    p x+i
    exit
  end
}


input = readlines()

meta = input.shift.chomp.split("\s").map{|x| x.to_i}

target_num = meta[0]

forbid_list = input.shift.split("\s").map{|x| x.to_i}

nearlest = nil
n_abs = nil
(-100..200).each do |x|
  next if forbid_list.include?(x)
  c_abs = (target_num - x).abs
  if n_abs.nil? || c_abs <= n_abs
    if n_abs.nil? || c_abs < n_abs
      nearlest = x
      n_abs = c_abs
      next
    end
    if c_abs == n_abs && nearlest > x
      nearlest = x
      n_abs = c_abs
    end
  end
end

puts nearlest


### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

x,n = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

a.sort!
if !a.include?(x)
  puts x
else
  num = 1
  while true
    if a.include?(x-num)
      if a.include?(x+num)
        num += 1
      else
        puts (x+num)
        break
      end
    elsif !a.include?(x-num)
      puts (x-num)
      break
    else
      puts (x+num)
      break
    end
  end
end

# 6 5
# 4 7 10 6 5


x, n = gets.split(' ').map(&:to_i)
ps = n == 0 ? [] : gets.split(' ').map(&:to_i)

result = 100
min_abs = 100

target_arr = (0..100).to_a.select { |i| !ps.include?(i) }

target_arr.each do |i|
  abs = (x - i).abs
  if abs < min_abs
    result = i
    min_abs = abs
  elsif abs == min_abs && i < result
    result = i
  end
end

puts result


x, n = gets.split.map(&:to_i)
if n != 0
  p = gets.split.map(&:to_i)
end
    i = 1
ans = nil

if n == 0
  puts x
elsif n != 0
  while ans == nil
    if p.include?(x - i) == false && p.include?(x + i) == false
      ans = x - i
    elsif p.include?(x - i) == false
      ans = x - i
    elsif p.include?(x + i) == false
      ans = x + i
    else i += 1
    end
  end
end

puts ans


x, n = gets.split.map(&:to_i)
if n != 0
  p = gets.split.map(&:to_i)
end

ans = nil

if n == 0
  puts x
elsif n != 0
  200.times{|i|
    break if ans != nil
    if p.include?(x - (i+1)) == false && p.include?(x + (i+1)) == false
      ans = x - (i+1)
    elsif p.include?(x - (i+1)) == false
      ans = x - (i+1)
    elsif p.include?(x + (i+1)) == false
      ans = x + (i+1)
    end
   }
end

puts ans


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashSet;
fn main() {
    input! {
        x: i32,
        n: i32,
        p: [i32; n],
    }
    let p: HashSet<_> = p.into_iter().collect();
    for i in 0..102 {
        for j in &[x - i, x + i] {
            if !p.contains(j) {
                println!("{}", j);
                return;
            }
        }
    }
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String{
    input!{
        source = src,
        x: isize,
        n: isize,
        pn: [isize; n],
    }

    let mut pnn = pn;
    pnn.sort();

    let ans1 = solve_rec_i(x, &pnn);
    let ans2 = solve_rec_d(x, &pnn);

    if let Some(a1) = ans1 {
        if let Some(b1) = ans2 {
            let a = x - a1;
            let aa = a * a;

            let b = x - b1;
            let bb = b * b;

            if aa > bb {
                return b1.to_string();
            } else if aa < bb {
                return a1.to_string();
            }
            if a1 >= b1 {
                return b1.to_string();
            }
            return a1.to_string();
        }
    }

    return 0.to_string();
}

fn solve_rec_i(x: isize, pn: &Vec<isize>) -> Option<isize> {
    let res = pn.binary_search(&x);
    if let Err(_v) = res {
        return Some(x);
    }

    let a = solve_rec_i(x + 1, pn);
    return a;
}
fn solve_rec_d(x: isize, pn: &Vec<isize>) -> Option<isize> {
    let res = pn.binary_search(&x);
    if let Err(_v) = res {
        return Some(x);
    }

    let a = solve_rec_d(x - 1, pn);
    return a;
}


#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::FromIterator;

fn main() {
    let mut reader = acio::Reader::from_stdin();
    let x: i64 = reader.read();
    let n: usize = reader.read();
    let mut ps: Vec<i64> = reader.read_by(n);
    ps.sort();
    let mut ns = 0;
    for k in 0..110 {
        if ps.first() == Some(&k) {
            assert_eq!(k, ps.remove(0))
        } else {
            if k <= x {
                ns = k;
                //println!("({})<", k);
            } else {
                if k - x < x - ns {
                    ns = k;
                    //println!("({})>", k);
                }
                //println!("({})><", k);
                break;
            }
        }
    }
    println!("{}", ns);
}

//-- MODULES --

/// Mathematics Module
#[allow(dead_code)]
mod math {
    use std::mem::swap;

    /// Methods for Each Integer Type
    pub trait Integer {}
    /// Implements trait Integer
    macro_rules! integer {
        ($t:ty) => {
            impl Integer for $t {}
        };
    }

    /// Methods for Each Natural Integer Type
    pub trait Natural {
        fn lcm(v1: Self, v2: Self) -> Self;
        fn gcd(v1: Self, v2: Self) -> Self;
        fn fact(n: Self) -> Self;
        fn perm(n: Self, k: Self) -> Self;
        fn comb(n: Self, k: Self) -> Self;
    }
    /// Implements trait Natural
    macro_rules! natural {
        ($t:ty) => {
            impl Natural for $t {
                fn lcm(v1: $t, v2: $t) -> $t {
                    v1 * v2 / Self::gcd(v1, v2)
                }

                fn gcd(v1: $t, v2: $t) -> $t {
                    let (mut v1, mut v2) = (v1, v2);
                    if v1 < v2 {
                        swap(&mut v1, &mut v2);
                    }
                    while v2 != 0 {
                        let t = v1;
                        v1 = v2;
                        v2 = t % v2;
                    }
                    return v1;
                }

                fn fact(n: $t) -> $t {
                    let mut a = 1;
                    for i in 1..=n {
                        a *= i;
                    }
                    return a;
                }

                fn perm(n: $t, k: $t) -> $t {
                    Self::fact(n) / Self::fact(n - k)
                }

                fn comb(n: $t, k: $t) -> $t {
                    Self::perm(n, k) / Self::fact(k)
                }
            }
        };
    }

    // BEGIN DECLARATIONS
    integer!(i8);
    integer!(i16);
    integer!(i32);
    integer!(i64);
    integer!(isize);
    integer!(u8);
    integer!(u16);
    integer!(u32);
    integer!(u64);
    integer!(usize);
    // ---
    natural!(u8);
    natural!(u16);
    natural!(u32);
    natural!(u64);
    natural!(usize);
    // END DECLARATIONS
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, BufRead, BufReader, Read, Stdin};
    use std::str::FromStr;

    /// Multi-Purpose Value Reader
    pub struct Reader<R>
    where
        R: Read,
    {
        input: BufReader<R>,
        stack: Vec<String>,
    }

    impl<R: Read> Reader<R> {
        /// Create Reader from Read
        pub fn new<T>(input: R) -> Self {
            // Self { // <- Warning: NOT YET on AtCoder
            Reader {
                input: BufReader::new(input),
                stack: vec![],
            }
        }

        /// Read Multiple Value
        pub fn read_by<F>(&mut self, count: usize) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            (0..count).map(|_| self.read()).collect()
        }

        /// Read Single Value
        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            while self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        /// Read Space Split Line
        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }

    impl Reader<Stdin> {
        /// Create Reader from stdin
        pub fn from_stdin() -> Self {
            Self::new::<Reader<Stdin>>(stdin())
        }
    }

    /*
    impl<T> Drop for Reader<T> {
        /// FOR DEBUG
        fn drop(&mut self) {
            if self.stack.len() != 0 {
                panic!("Reader with remaining value is dropped.")
            }
        }
    }
    */
}


#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        x: usize,
        n: usize,
        p: [usize; n],
    }
    let mut ans = if n == 0 { x } else { 1000 };

    for i in (0..x).rev() {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        ans = i;
        break;
    }

    for i in x..101+1 {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        if ans <= x && x - ans == i - x {
            break;
        }
        ans = i;
        break;
    }

    if ans == 1000 {
        ans = 0;
    }

    println!("{}", ans);
}


#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        x: usize,
        n: usize,
        p: [usize; n],
    }
    let mut ans = if n == 0 { x } else { 1000 };

    for i in (0..x).rev() {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        ans = i;
        break;
    }

    for i in x..101+1 {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        if ans <= x && x - ans == i - x {
            break;
        }
        ans = i;
        break;
    }

    println!("{}", ans);
}


#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        x: usize,
        n: usize,
        p: [usize; n],
    }
    let mut ans = if n == 0 { x } else { 1000 };

    for i in (0..x).rev() {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        ans = i;
        break;
    }

    for i in x..100+1 {
        if 0 < p.iter().filter(|&&l| l == i).count() {
            continue;
        }
        if ans <= x && x - ans == i - x {
            break;
        }
        ans = i;
        break;
    }

    println!("{}", ans);
}


let inputs = readLine()!.split(separator: " ").map { Int($0)! }

let X = inputs[0]
let N = inputs[1]

if N == 0 {
  print(X)
} else {
	let banned = Set(readLine()!.split(separator: " ").map { Int($0)! })
  	var lessThan = X
  	var graterThan = X
  	for num in X...101 {
      if !banned.contains(num) {
        graterThan = num
        break
      }
    }
  	for num in (0...X).reversed() {
      if !banned.contains(num) {
        lessThan = num
        break
      }
    }
  	if (graterThan - X) * (graterThan - X) > (lessThan - X) * (lessThan - X) {
      print(lessThan)
    } else if (graterThan - X) * (graterThan - X) < (lessThan - X) * (lessThan - X) {
      print(graterThan)
    } else {
      print(lessThan)
    }
}


class C {
    static func solve() {
        let X = readLine()!.split(separator: " ").map { Int($0)! }.first!
        let ps = readLine()!.split(separator: " ").map { Int($0)! }.sorted()

        if ps.isEmpty {
            print(X)
            return
        }

        var temp = 500
        var diffTemp = 500
        ps.forEach { i in
            let diff = min(abs(X - i), diffTemp)
            if diff < diffTemp {
                temp = i
                diffTemp = diff
            }
        }
        var diff = 0
        while true {
            if !ps.contains(temp - diff) {
                print(temp - diff)
                break
            } else if !ps.contains(temp + diff) {
                print(temp + diff)
                break
            } else {
                diff += 1
            }
        }
    }
}

C.solve()


import Foundation

let (x, n) = readInts().mapToTuple()
let ps = Set(readInts())
let r = Set(0...101)
    .symmetricDifference(ps)
    .sorted(by: <)
    .sorted { abs($0 - x) < abs($1 - x) }
print(r.first!)

// MARK: -----------------------------------------------------------------------

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

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

extension Collection {
    func mapToTuple() -> (Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!, i.next()!)
    }
}

struct DP<Argument: Hashable, Element> {
    var dictionary = [Argument: Element]()

    var expression: (Argument, (Argument) -> Element) -> Element

    init(expression: @escaping (_ argument: Argument, _ note: (Argument) -> Element) -> Element) {
        self.expression = expression
    }

    subscript(_ argument: Argument) -> Element {
        mutating get {
            if let note = dictionary[argument] {
                return note
            } else {
                let result = expression(argument) { self[$0] }
                dictionary[argument] = result
                return result
            }
        }
    }
}


let xn = readLine()!.split(separator: " ").map{Int($0)!}
let x = xn[0]
let n = xn[1]
let pArray = readLine()!.split(separator: " ").map{Int($0)!}
var lastSmallerX: Int?
var firstBiggerX: Int?

for i in 0...101 {
    if i > x {
        if pArray.contains(i) {
            continue
        } else {
            firstBiggerX = i
            break
        }
    } else {
        if pArray.contains(i) {
            continue
        } else {
            lastSmallerX = i
            continue
        }
    }
}

print(x - lastSmallerX <= firstBiggerX - x ? lastSmallerX! : firstBiggerX!)


import Foundation

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

if N == 0 {
    print(X)
    exit(0)
}

let numbers = readLine()!.components(separatedBy: " ").map({Int($0)!}).sorted()
// numbersの中に含まれない数を抜き出す
let targetValues = [Int]((numbers[0]-1)...(numbers[N-1]+1)).filter{!numbers.contains($0)}

print(targetValues)
if targetValues.count == 0 {
    // 全て連続していた場合
    print(X)
    exit(0)
}

// Xとの絶対値が一番小さいものを探す
var ans = X
var diff = Int.max
for val in targetValues {
    let tmp = abs(val - X)
    if tmp < diff {
        ans = val
        diff = tmp
    }
}

print(ans)


export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [x, n]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    if (n == 0) {
      return `${x}`;
    }
    const p: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const pSet = new Set();
    for (let i = 0, len = p.length; i < len; i++) {
      pSet.add(p[i]);
    }
    let i = 0;
    while (true) {
      if (!pSet.has(x - i)) {
        return `${x - i}`;
      }
      if (!pSet.has(x + i)) {
        return `${x + i}`;
      }
      i++;
    }
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const [xn, _p] = input.split('\n');
const [x, n] = xn.split(' ').map((s) => s >> 0);
const p = new Set(
  _p
    .split(' ')
    .filter((s) => s)
    .map((s) => s >> 0)
);

// console.log(x, n);
// console.log(p);

for (let diff = 0; diff < 100; diff++) {
  // 下方向を見る
  const down = x - diff;
  if (!p.has(down)) {
    console.log(down);
    break;
  }

  // 上方向を見る
  const up = x + diff;
  if (!p.has(up)) {
    console.log(up);
    break;
  }
}


// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [X, N] = r.nn()

    if (N === 0) return X
    const p = r.nn()

    const lib = {}

    p.forEach((pv) => {
      lib[pv] = true
    })
    if (!lib[X]) return X
    for (let i = 1; i < 1000; i++) {
      if (!lib[X - i]) return X - i
      if (!lib[X + i]) return X + i
    }

    return -1
  }

  const _io = (i = 0) => {
    const str = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}


import * as fs from 'fs';
import { EDEADLK } from 'constants';

// main
function main(input: string[]) {
    // param
    var x: number = 0;
    var n: number = 0;
    var pn: number[] = [];
    var ans: number = 0;
    // init
    [x, n] = input.shift().split(" ").map(x => Number(x));
    if (0 < n) {
        pn = input.shift().split(" ").map(x => Number(x));
    }
    // solve
    var pa = new Array(101).fill(-1);
    for (var pnx = 0; pnx < pn.length; pnx++) {
        pa[pn[pnx]] = 1;
    }
    for (var i = 0; i < pa.length; i++) {
        if (pa[x - i] == -1) {
            ans = x - i;
            break;
        }
        if (pa[x + i] == -1) {
            ans = x + i;
            break;
        }
    }
    // answer
    console.log(ans);
}

// graph lib
/*
function GRAPH_enumPattern(cur: number[], pat: number[][]): number[][] {
    var arr = [];
    for (var patx = 0; patx < pat.length; patx++) {
        var pos = [cur[0] + pat[patx][0], cur[1] + pat[patx][1]];
        arr.push(pos);
    }
    return arr;
}
*/

// math lib
/*
function Math_max(arr: number[]): number { return arr.reduce((x, y) => Math.max(x, y)); }
function Math_min(arr: number[]): number { return arr.reduce((x, y) => Math.min(x, y)); }
function Math_gcd(): number {
    var ans = arguments[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < arguments.length; i++) {
        ans = f(ans, arguments[i]);
    }
    return ans
};
function Math_gcdArray(values: number[]): number {
    var ans = values[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < values.length; i++) {
        ans = f(ans, values[i]);
    }
    return ans
};
function Math_lcm(): number {
    var a = arguments
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_lcmArray(values: number[]): number {
    var a = values
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_primeList(value: number): number[] {
    var ans = [];
    var arr = new Array(value).fill(0);
    for (var i = 2; i < value; i++) {
        if (arr[i] == 0) {
            for (var j = i; j < value; j += i) {
                if (arr[j] == 0) arr[j] = i;
            }
        }
    }
    for (var i = 2; i < value; i++) {
        if (arr[i] == i) ans.push(i);
    }
    return ans;
}
function Math_primeFactor(p: number[], value: number): number[][] {
    var ans: number[][] = [];
    var valmax = value / 2;;
    for (var i = 0; i < p.length; i++) {
        var prime = p[i];
        if (valmax < prime) break;
        var count = 0;
        while (value % prime == 0) {
            value /= prime;
            count++;
        }
        if (count != 0) {
            ans.push([prime, count]);
        }
        if (value == 1) break;
    }
    return ans;
}
*/

// union-find lib
/*
var g_uf_root: number[];
var g_uf_count: number[];
function UF_initRoot(num: number) {
    g_uf_root = new Array(num).fill(-1);
    g_uf_count = new Array(num).fill(1);
}
function UF_getRoot(index: number) {
    if (g_uf_root[index] < 0) {
        return index;
    } else {
        var work0: number = UF_getRoot(g_uf_root[index]);
        g_uf_root[index] = work0;
        return work0
    }
}
function UF_mergeRoot(a: number, b: number) {
    var root0: number = UF_getRoot(a);
    var root1: number = UF_getRoot(b);
    if (root0 == root1) return;
    if (root0 > root1) [root0, root1] = [root1, root0];
    g_uf_count[root0] += g_uf_count[root1];
    g_uf_count[root1] = 0;
    g_uf_root[root1] = root0;
}
*/

// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();