import numpy as np
import numba


@numba.njit
def count(a_arr, bar):
    # <= bar
    res_arr = ((a_arr - 1) // bar)
    new_bar = (a_arr / (res_arr + 1)).max()
    return res_arr.sum(), np.int(np.ceil(new_bar))


def solve(n, k, a_arr):
    left_bar = ((a_arr - 1) // (k + 1)).min()
    right_bar = a_arr.max()
    while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
    return right_bar


def main():
    n_, k_ = map(int, input().split())
    n = np.int32(n_)
    k = np.int32(k_)
    a_arr = np.array(list(map(int, input().split())), dtype=np.int32)
    res = solve(n, k, a_arr)
    print(res)


def test():
    assert solve(2, 3, np.array([7, 9])) == 4
    assert solve(3, 0, np.array([3, 4, 5])) == 5
    assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192


if __name__ == "__main__":
    test()
    main() import numpy as np numpy import numba numba def count(a_arr, bar):
    # <= bar
    res_arr = ((a_arr - 1) // bar)
    new_bar = (a_arr / (res_arr + 1)).max()
    return res_arr.sum(), np.int(np.ceil(new_bar)) count res_arr = ((a_arr - 1) // bar) res_arr (a_arr - 1) // bar a_arr - 1 a_arr 1 bar new_bar = (a_arr / (res_arr + 1)).max() new_bar (a_arr / (res_arr + 1)).max() a_arr / (res_arr + 1)).max a_arr / (res_arr + 1) a_arr res_arr + 1 res_arr 1 max return res_arr.sum(), np.int(np.ceil(new_bar)) return res_arr.sum(), np.int(np.ceil(new_bar)) res_arr.sum() res_arr.sum res_arr sum np.int(np.ceil(new_bar)) np.int np int np.ceil(new_bar) np.ceil np ceil new_bar a_arr a_arr bar bar @numba.njit count numba.njit count def solve(n, k, a_arr):
    left_bar = ((a_arr - 1) // (k + 1)).min()
    right_bar = a_arr.max()
    while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
    return right_bar solve left_bar = ((a_arr - 1) // (k + 1)).min() left_bar ((a_arr - 1) // (k + 1)).min() (a_arr - 1) // (k + 1)).min (a_arr - 1) // (k + 1) a_arr - 1 a_arr 1 k + 1 k 1 min right_bar = a_arr.max() right_bar a_arr.max() a_arr.max a_arr max while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
     True mid_bar = (left_bar + right_bar) // 2 mid_bar (left_bar + right_bar) // 2 left_bar + right_bar left_bar right_bar 2 m, mid_bar_new = count(a_arr, mid_bar) m count(a_arr, mid_bar) count a_arr mid_bar mid_bar_new if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

         m > k m k left_bar = mid_bar left_bar mid_bar right_bar = mid_bar_new right_bar mid_bar_new if left_bar > right_bar - 2:
            break
     left_bar > right_bar - 2 left_bar right_bar - 2 right_bar 2 break return right_bar right_bar n n k k a_arr a_arr def main():
    n_, k_ = map(int, input().split())
    n = np.int32(n_)
    k = np.int32(k_)
    a_arr = np.array(list(map(int, input().split())), dtype=np.int32)
    res = solve(n, k, a_arr)
    print(res) main n_, k_ = map(int, input().split()) n_ map(int, input().split()) map int input().split() ().split () input split k_ n = np.int32(n_) n np.int32(n_) np.int32 np int32 n_ k = np.int32(k_) k np.int32(k_) np.int32 np int32 k_ a_arr = np.array(list(map(int, input().split())), dtype=np.int32) a_arr np.array(list(map(int, input().split())), dtype=np.int32) np.array np array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split dtype=np.int32 dtype np.int32 np int32 res = solve(n, k, a_arr) res solve(n, k, a_arr) solve n k a_arr print(res) print res def test():
    assert solve(2, 3, np.array([7, 9])) == 4
    assert solve(3, 0, np.array([3, 4, 5])) == 5
    assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192 test assert solve(2, 3, np.array([7, 9])) == 4 solve(2, 3, np.array([7, 9])) == 4 solve(2, 3, np.array([7, 9])) solve 2 3 np.array([7, 9]) np.array np array [7, 9] 7 9 4 assert solve(3, 0, np.array([3, 4, 5])) == 5 solve(3, 0, np.array([3, 4, 5])) == 5 solve(3, 0, np.array([3, 4, 5])) solve 3 0 np.array([3, 4, 5]) np.array np array [3, 4, 5] 3 4 5 5 assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192 solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192 solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) solve 10 10 np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ]) np.array np array [
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ] 158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202 292638192 if __name__ == "__main__":
    test()
    main() __name__ == "__main__" __name__ "__main__" test() test main() main def main():
    n_, k_ = map(int, input().split())
    n = np.int32(n_)
    k = np.int32(k_)
    a_arr = np.array(list(map(int, input().split())), dtype=np.int32)
    res = solve(n, k, a_arr)
    print(res) def main():
    n_, k_ = map(int, input().split())
    n = np.int32(n_)
    k = np.int32(k_)
    a_arr = np.array(list(map(int, input().split())), dtype=np.int32)
    res = solve(n, k, a_arr)
    print(res) main def count(a_arr, bar):
    # <= bar
    res_arr = ((a_arr - 1) // bar)
    new_bar = (a_arr / (res_arr + 1)).max()
    return res_arr.sum(), np.int(np.ceil(new_bar)) def count(a_arr, bar):
    # <= bar
    res_arr = ((a_arr - 1) // bar)
    new_bar = (a_arr / (res_arr + 1)).max()
    return res_arr.sum(), np.int(np.ceil(new_bar)) count def solve(n, k, a_arr):
    left_bar = ((a_arr - 1) // (k + 1)).min()
    right_bar = a_arr.max()
    while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
    return right_bar def solve(n, k, a_arr):
    left_bar = ((a_arr - 1) // (k + 1)).min()
    right_bar = a_arr.max()
    while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
    return right_bar solve def test():
    assert solve(2, 3, np.array([7, 9])) == 4
    assert solve(3, 0, np.array([3, 4, 5])) == 5
    assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192 def test():
    assert solve(2, 3, np.array([7, 9])) == 4
    assert solve(3, 0, np.array([3, 4, 5])) == 5
    assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192 test
import numpy as np
import numba


@numba.njit
def count(a_arr, bar):
    # <= bar
    res_arr = ((a_arr - 1) // bar)
    new_bar = (a_arr / (res_arr + 1)).max()
    return res_arr.sum(), np.int(np.ceil(new_bar))


def solve(n, k, a_arr):
    left_bar = ((a_arr - 1) // (k + 1)).min()
    right_bar = a_arr.max()
    while True:
        mid_bar = (left_bar + right_bar) // 2
        # print(left_bar, right_bar, mid_bar)
        m, mid_bar_new = count(a_arr, mid_bar)

        if m > k:
            left_bar = mid_bar
        else:
            right_bar = mid_bar_new

        if left_bar > right_bar - 2:
            break
    return right_bar


def main():
    n_, k_ = map(int, input().split())
    n = np.int32(n_)
    k = np.int32(k_)
    a_arr = np.array(list(map(int, input().split())), dtype=np.int32)
    res = solve(n, k, a_arr)
    print(res)


def test():
    assert solve(2, 3, np.array([7, 9])) == 4
    assert solve(3, 0, np.array([3, 4, 5])) == 5
    assert solve(10, 10, np.array([
        158260522, 877914575, 602436426, 24979445, 861648772,
        623690081, 433933447, 476190629, 262703497, 211047202
    ])) == 292638192


if __name__ == "__main__":
    test()
    main()
