Buggy python submission (verdict: Runtime Error):
import sys,math,collections,itertools,heapq
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
under=0
upper=max(A)
num = upper//2

while True:
    ans = 0
    for a in A:
        ans += math.ceil(a/num)-1
    if ans >K:
        under = num
        num = math.ceil((num+upper)/2)
    else:
        upper = num
        num = math.floor((num+under)/2)
    if upper-under ==1:
        print(upper)
        break
    if num==0:
        print(1)
        break


    


Fixed submission:
import sys,math,collections,itertools,heapq
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
under=0
upper=max(A)
num = upper//2

while True:
    ans = 0
    if num == 0:
        print(1)
        exit()
    for a in A:
        ans += math.ceil(a/num)-1
    if ans >K:
        under = num
        num = math.ceil((num+upper)/2)
    else:
        upper = num
        num = math.floor((num+under)/2)
    if upper-under ==1:
        print(upper)
        break

Buggy python submission (verdict: Runtime Error):
import sys,math,collections,itertools,heapq
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
under=0
upper=max(A)
num = upper//2

while True:
    ans = 0
    for a in A:
        ans += math.ceil(a/num)-1
    if ans >K:
        under = num
        num = math.ceil((num+upper)/2)
    else:
        upper = num
        num = math.floor((num+under)/2)
    if upper-under ==1:
        print(upper)
        break


    


Fixed submission:
import sys,math,collections,itertools,heapq
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
under=0
upper=max(A)
num = upper//2

while True:
    ans = 0
    if num == 0:
        print(1)
        exit()
    for a in A:
        ans += math.ceil(a/num)-1
    if ans >K:
        under = num
        num = math.ceil((num+upper)/2)
    else:
        upper = num
        num = math.floor((num+under)/2)
    if upper-under ==1:
        print(upper)
        break

Buggy python submission (verdict: Runtime Error):
import sys,math,collections,itertools,heapq
input = sys.stdin.readline
def f(n):
    return -1*n

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
memo = [-1]*(max(A)+1)
memo[0]=0
memo[max(A)]=1
num = max(A)//2
num_upper = max(A)
num_under =0

while True:
    cnt = 0
    tmp = num
    for a in A:
        cnt += math.ceil(a/num)-1
    if cnt <=K:
        memo[num]=1
        num_upper = num
        num = (num+num_under)//2
    else:
        memo[num]=0
        num_under = num
        num = (num+num_upper)//2
    if memo[tmp] == 0 and memo[tmp+1]==1:
        print(tmp+1)
        exit()
    elif memo[tmp]==1 and memo[tmp]==0:
        print(tmp)
        exit()
        
    


Fixed submission:
import sys,math,collections,itertools,heapq
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))
under=0
upper=max(A)
num = upper//2

while True:
    ans = 0
    if num == 0:
        print(1)
        exit()
    for a in A:
        ans += math.ceil(a/num)-1
    if ans >K:
        under = num
        num = math.ceil((num+upper)/2)
    else:
        upper = num
        num = math.floor((num+under)/2)
    if upper-under ==1:
        print(upper)
        break