Buggy python submission (verdict: Time Limit Exceeded):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, K = getNM()
A = getList()
A = [-i for i in A]

# 単純に大きいのを1 / 2していては
# 3.5, 3.5, 4.5, 2.25, 2.25ができるのでダメ

def f(target):
    alta = copy.deepcopy(A)
    heapq.heapify(alta)
    for i in range(K):
        max_value = heapq.heappop(alta) * (-1)
        max_value_a = min(target, max_value)
        max_value_b = max_value - max_value_a
        heapq.heappush(alta, max_value_a * (-1))
        heapq.heappush(alta, max_value_b * (-1))

    u = heapq.heappop(alta) * (-1)
    if u <= target:
        return True
    else:
        return False

ng = 0
ok = 10 ** 12 + 1
for i in range(100):
    mid = (ng + ok) / 2
    # midがでかすぎるなら上限を下げる
    if f(mid):
        ok = mid
    # midが小さすぎるなら下限を上げる
    else:
        ng = mid

print(math.ceil(ng))

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, K = getNM()
A = getList()

# 単純に大きいのを1 / 2していては
# 3.5, 3.5, 4.5, 2.25, 2.25ができるのでダメ

# Kがばか大きい

def f(target):
    cnt = 0
    for i in range(N):
        cnt += math.ceil(A[i] / target) - 1
    if cnt <= K:
        return True
    else:
        return False

ng = 0
ok = 10 ** 9 + 1
for i in range(100):
    mid = (ng + ok) / 2
    # midがでかすぎるなら上限を下げる
    if f(mid):
        ok = mid
    # midが小さすぎるなら下限を上げる
    else:
        ng = mid
print(math.ceil(ok))

Buggy python submission (verdict: Time Limit Exceeded):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, K = getNM()
A = getList()
A = [-i for i in A]

# 単純に大きいのを1 / 2していては
# 3.5, 3.5, 4.5, 2.25, 2.25ができるのでダメ

def f(target):
    alta = copy.deepcopy(A)
    heapq.heapify(alta)
    for i in range(K):
        max_value = heapq.heappop(alta) * (-1)
        max_value_a = min(target, max_value)
        max_value_b = max_value - max_value_a
        heapq.heappush(alta, max_value_a * (-1))
        heapq.heappush(alta, max_value_b * (-1))

    u = heapq.heappop(alta) * (-1)
    if u <= target:
        return True
    else:
        return False

ng = 0
ok = 10 ** 12 + 1
while ok - ng > 10 ** -5:
    mid = (ng + ok) / 2
    # midがでかすぎるなら上限を下げる
    if f(mid):
        ok = mid
    # midが小さすぎるなら下限を上げる
    else:
        ng = mid

print(math.ceil(ng))

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, K = getNM()
A = getList()

# 単純に大きいのを1 / 2していては
# 3.5, 3.5, 4.5, 2.25, 2.25ができるのでダメ

# Kがばか大きい

def f(target):
    cnt = 0
    for i in range(N):
        cnt += math.ceil(A[i] / target) - 1
    if cnt <= K:
        return True
    else:
        return False

ng = 0
ok = 10 ** 9 + 1
for i in range(100):
    mid = (ng + ok) / 2
    # midがでかすぎるなら上限を下げる
    if f(mid):
        ok = mid
    # midが小さすぎるなら下限を上げる
    else:
        ng = mid
print(math.ceil(ok))