Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
# def is_ok(arg):
#     # 条件を満たすかどうか？問題ごとに定義
#     return sum(-(-i // arg) - 1 for i in a) <= k
# 
# 
# def meguru_bisect(ng, ok):
#     '''
#     初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
#     まずis_okを定義すべし
#     ng ok は  とり得る最小の値-1 とり得る最大の値+1
#     最大最小が逆の場合はよしなにひっくり返す
#     '''
#     while (abs(ok - ng) > 1):
#         mid = (ok + ng) // 2
#         if is_ok(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok
# print(meguru_bisect(0, max(a)))
import math
import heapq
b = [(-i,1) for i in a]
heapq.heapify(b)
for _ in range(k):
    p, q = heapq.heappop(b)
    heapq.heappush(b, (p*q/(q+1),q+1))
print(math.ceil(-heapq.heappop(b)[0]))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0, max(a)))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
# def is_ok(arg):
#     # 条件を満たすかどうか？問題ごとに定義
#     return sum(-(-i // arg) - 1 for i in a) <= k
# 
# 
# def meguru_bisect(ng, ok):
#     '''
#     初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
#     まずis_okを定義すべし
#     ng ok は  とり得る最小の値-1 とり得る最大の値+1
#     最大最小が逆の場合はよしなにひっくり返す
#     '''
#     while (abs(ok - ng) > 1):
#         mid = (ok + ng) // 2
#         if is_ok(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok
# print(meguru_bisect(0, max(a)))
import math
import heapq
b = [(-i,1) for i in a]
heapq.heapify(b)
for _ in range(k):
    p, q = heapq.heappop(b)
    heapq.heappush(b, (p*q/(q+1),q+1))
print(math.ceil(-heapq.heappop(b)[0]))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0, max(a)))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from bisect import insort_left
from collections import deque
from math import ceil

n, k = map(int, input().split())
a = [[i, 1] for i in map(int, input().split())]
A = sorted(a)
while k > 0:
    q, c = A.pop()
    insort_left(A, [q * c / (c + 1), c + 1])
    k -= 1
print(ceil(A[-1][0]))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0, max(a)))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from bisect import insort_left
from collections import deque
from math import ceil

n, k = map(int, input().split())
a = [[i, 1] for i in map(int, input().split())]
A = deque(sorted(a))
while k > 0:
    q, c = A.pop()
    insort_left(A, [q * c / (c + 1), c + 1])
    k -= 1
print(ceil(A[-1][0]))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0, max(a)))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from bisect import insort_left
from collections import deque
from math import ceil

n, k = map(int, input().split())
a = [[i, 1] for i in map(int, input().split())]
A = deque(sorted(a))
while k > 0:
    q, c = A.pop()
    insort_left(A, [q * c / (c + 1), c + 1])
    k -= 1
print(ceil(A[-1][0]))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_left

n, k = map(int, input().split())
*a, = map(int, input().split())
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0, max(a)))