Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
from fractions import Fraction
from sys import exit
import heapq

n,k, *aa = map(Fraction, open(0).read().split())

left = k/2
right = k*2 + 1
mid = k/2
summ = sum(aa)
score = None
while 1:
    x = [(ceil(mid*a/summ), a) for a in aa]
    prev = score
    score = sum(a[0]-1 for a in x)
    if prev == score:
        break
    if score > k:
        right = mid
        mid = (left + right) / 2
    elif score < k:
        left = mid
        mid = (left + right) / 2
    else:
        values = [ceil(a/v) for v,a in x]
        print(max(values))
        exit()

x = [(-a/c, c, a) for c,a in x]
heapq.heapify(x)

for _ in range(int(k-score)):
    v,c,a = heapq.heappop(x)
    c += 1
    v = -a/c
    heapq.heappush(x, (v,c,a))

print(ceil(-x[0][0]))

Fixed submission:
from math import ceil

n,k, *aa = map(int, open(0).read().split())

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
from fractions import Fraction
n,k, *aa = map(Fraction, open(0).read().split())

left = max(1,k/2)
right = left * 4
mid = (left + right)/2
summ = sum(aa)

while 1:
    x = [(ceil((mid)*a/summ), a) for a in aa]
    score = sum(a[0]-1 for a in x)
    if score > k:
        right = mid
        mid = (left + right) / 2
    elif score < k:
        left = mid
        mid = (left + right) / 2
    else:
        values = [ceil(a/v) for v,a in x]
        print(max(values))
        break

Fixed submission:
from math import ceil

n,k, *aa = map(int, open(0).read().split())

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
from fractions import Fraction
n,k, *aa = map(Fraction, open(0).read().split())

left = k/2
right = 2*k
mid = (left + right)/2
summ = sum(aa)

while 1:
    x = [(ceil((mid)*a/summ), a) for a in aa]
    score = sum(a[0]-1 for a in x)
    if score > k:
        right = mid
        mid = (left + right) / 2
    elif score < k:
        left = mid
        mid = (left + right) / 2
    else:
        values = [ceil(a/v) for v,a in x]
        print(max(values))
        break

Fixed submission:
from math import ceil

n,k, *aa = map(int, open(0).read().split())

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction
from math import ceil
import heapq
n,k, *aa = map(int, open(0).read().split())

hq = [(-a,-1,-a) for a in aa]
heapq.heapify(hq)

for _ in range(k):
    v,cnt,orig = heapq.heappop(hq)
    cnt *= -1
    cnt += 1
    v = orig / cnt
    cnt *= -1
    heapq.heappush(hq, (v,cnt,orig))

print(max([ceil(-a) for a,b,c in hq]))

Fixed submission:
from math import ceil

n,k, *aa = map(int, open(0).read().split())

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction
from math import ceil
import heapq
n,k, *aa = map(Fraction, open(0).read().split())
k = int(k)

hq = [(-a,-1,-a) for a in aa]
heapq.heapify(hq)

for _ in range(k):
    v,cnt,orig = heapq.heappop(hq)
    cnt *= -1
    cnt += 1
    v = orig / cnt
    cnt *= -1
    heapq.heappush(hq, (v,cnt,orig))

print(max([ceil(-a) for a,b,c in hq]))

Fixed submission:
from math import ceil

n,k, *aa = map(int, open(0).read().split())

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)