CodeEff/ECCO huggingface dataset:
# Original solution
import math, heapq
N, K = list(map(int, input().split()))

a = list(map(int, input().split()))
a.sort(reverse=True)
lst = []
for i in a:
    lst.append([-i, 0])

heapq.heapify(lst)

for i in range(K):
    p = heapq.heappop(lst)
    p[1] += 1
    p[0] = p[0] * p[1] / (p[1] + 1)
    heapq.heappush(lst, p)
p = heapq.heappop(lst)
print((math.ceil(-p[0])))

# Optimized solution
import math
N, K = list(map(int, input().split()))

a = list(map(int, input().split()))

def cal(x):
    s = 0
    for aa in a:
        s += math.ceil(aa / x) - 1
    if s <= K: return True
    else: return False

l = 0
r = max(a)
while abs(r - l) > 1:
    mid = (l + r) // 2
    if cal(mid):
        r = mid
    else:
        l = mid
print(r)
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def f(x):
    cnt = k
    for i in a:
        tmp = math.ceil(i / x)
        cnt -= tmp - 1
        if cnt < 0:
            return False
    return True

n, k = LI()
a = LI()
a.sort(reverse=True)
ok = sum(a)
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)

# Optimized solution
#!/usr/bin/env python3
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

def f(x):
    cnt = 0
    for i in a:
        cnt += (i-1) // x
        if cnt > k:
            return False
    return True
            
ok = 10**9
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)
# Original solution
from heapq import heappop, heappush, heapify

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

q = []
for x in a:
    heappush(q, (-x, 1, x))


for i in range(k):
    _, dc, p = heappop(q)
    dc += 1
    v = -(-p//dc)
    heappush(q, (-v, dc, p))


ans = 0
for x, _, _ in q: ans = max(ans, -x)

print(ans)


# Optimized solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

def f(m):
    res = sum([-(-x//m)-1 for x in a])
    return res <= k

l, r = 0, 10**9+10

while r-l > 1:
    x = (l+r)//2
    if f(x): r = x
    else: l = x

print(r)
# Original solution
N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  if x==0:
    return False
  
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid

# Optimized solution
N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  if x==0:
    return float("inf")
  
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid
# Original solution
N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  if x==0:
    return float("inf")
  
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid

# Optimized solution
N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)

memo={0:False}
def isOK(x):
  if x in memo:
    return memo[x]
  
  num_cut=0
  for a in alist:
    num_cut+=-(-(a-x)//x)
    if num_cut>K:
      memo[x]=False
      return False  
    
  memo[x]=True
  return True

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  
  if not isOK(mid-1) and isOK(mid):
    print(mid)
    break
  elif isOK(mid-1):
    r=mid
  else:
    l=mid
# Original solution
from heapq import heappush, heappop
from math import ceil


def main():
    n, k = list(map(int, input().split()))
    a = [int(i) for i in input().split()]
    c = [1] * n
    h = []
    for i, ai in enumerate(a):
        heappush(h, (-ai, i))
    for _ in range(k):
        ai, i = heappop(h)
        ci = c[i]
        ai = ai * ci / (ci + 1)
        heappush(h, (ai, i))
        c[i] += 1
    print((ceil(-h[0][0])))


if __name__ == '__main__':
    main()


# Optimized solution
from math import ceil


def main():
    n, k = list(map(int, input().split()))
    a = sorted([int(i) for i in input().split()], reverse=True)
    left = 0
    right = a[0]
    while right - left > 1:
        ki = k
        mid = left + (right - left) // 2
        for ai in a:
            if ki < 0:
                left = mid
                break
            if ai <= mid:
                right = mid
                break
            ki -= ceil(ai / mid) - 1
        else:
            if ki < 0:
                left = mid
            else:
                right = mid
    print(right)


if __name__ == '__main__':
    main()
# Original solution
import heapq
import math

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
if k == 0:
    print((a[0]))
    exit(0)
mean_a = sum(a) / k
q = []
for aa in a:
    d = max(math.floor(aa / mean_a)-2, 1)
    q.append((-aa/d, d))
    k -= (d-1)
heapq.heapify(q)

for _ in range(k):
    aa, n = heapq.heappop(q)
    heapq.heappush(q, (aa*n/(n+1), n+1))

ans, _ = heapq.heappop(q)
print((math.ceil(-ans)))


# Optimized solution
import heapq
import math

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
if k == 0:
    print((a[0]))
    exit(0)
mean_a = sum(a) / k
q = []
for aa in a:
    d = max(math.floor(aa / mean_a)-1, 1)
    q.append((-aa/d, d))
    k -= (d-1)
heapq.heapify(q)

for _ in range(k):
    aa, n = heapq.heappop(q)
    heapq.heappush(q, (aa*n/(n+1), n+1))

ans, _ = heapq.heappop(q)
print((math.ceil(-ans)))
# Original solution
import math
import heapq
N, K = list(map(int, input().split()))
A = sorted([(-int(i), int(i), 1) for i in input().split()])
heapq.heapify(A)  # リストhqのheap化

for _ in range(K):
    _, L, T = heapq.heappop(A)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    heapq.heappush(A, (-L/(T+1), L, T+1))  # heap化されたリストhqに要素xを追加
_, L, T = heapq.heappop(A)
print((math.ceil(L/T)))


# Optimized solution
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)
# Original solution
import heapq
n,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]

hq = []

for i in range(n):
    a[i] = -a[i]

for i in range(n):
    heapq.heappush(hq,[a[i],i,1])

for i in range(k):
    val,idx,waru = heapq.heappop(hq)
    heapq.heappush(hq, [a[idx]/(waru+1),idx,waru+1])
    #print(hq)
    
val,idx,waru = heapq.heappop(hq)

if val % 1 == 0:
    print((int(val)*(-1)))
else:
    print((int(val)*(-1)+1))

# Optimized solution
import heapq
n,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]

low = 0
high = 10**9

if k == 0:
    print((max(a)))
    exit()

    
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
        
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)
# Original solution
import heapq
import math
import sys

input = sys.stdin.readline


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    for i in range(N):
        p = A[i]
        A[i] = [-p, i]

    heapq.heapify(A)
    C = [0]*N
    for j in range(K):
        x, y = heapq.heappop(A)
        cnt = C[y]
        x = x * (cnt+1) / (cnt+2)
        C[y] += 1
        heapq.heappush(A, [x, y])

    ans = heapq.heappop(A)[0]

    ans = math.ceil(-ans)

    print(ans)

if __name__ == "__main__":
    main()




# Optimized solution
import heapq
import math
import sys

input = sys.stdin.readline


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    def C(m):
        cnt = 0
        for i in range(N):
            cnt += math.ceil(A[i]/m)-1
        return cnt

    l, r = 0, max(A)
    while r - l > 1:
        mid = (l+r)//2
        if C(mid) <= K:
            r = mid
        else:
            l = mid
    
    print(r)

if __name__ == "__main__":
    main()
# Original solution
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    l = 1
    r = max(a)
    while l < r:
        m = (l+r)//2
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        if cnt > k: l = m+1
        else: r = m
    print(r)
    


if __name__ == '__main__':
    main()

# Optimized solution
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    
    def check(m):
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        return cnt <= k
        
    l, r = 0, max(a)
    while r-l > 1:
        m = (r+l)//2
        if check(m): r = m
        else: l = m
    print(r)

    


if __name__ == '__main__':
    main()
# Original solution
import heapq 
import math

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

lst = []
for i in range(n):
  lst.append([-a[i], 1])
  
heapq.heapify(lst)

for i in range(k):
  pop = heapq.heappop(lst)
  pop = [pop[0]*(pop[1])/(pop[1]+1), pop[1]+1]
  heapq.heappush(lst, pop)
  
pop = heapq.heappop(lst)
print((math.ceil(-pop[0])))

# Optimized solution
n, k = list(map(int, input().split()))
log = list(map(int, input().split()))

left = 0
right = 10**9

while right - left > 1:
  
  mid = (left + right) // 2
  
  cut = 0
  for i in range(n):
    cut += -(log[i]//-mid)-1

  if cut > k:
    left = mid
  else:
    right = mid
    
print(right)
# Original solution
from heapq import heappop,heappush
from math import ceil
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
hq=[]
for x in a:
	heappush(hq,[-x,1])
for i in range(k):
	r=heappop(hq)
	heappush(hq,[r[0]*r[1]/(r[1]+1),r[1]+1])
ans=-heappop(hq)[0]
print((ceil(ans)))

# Optimized solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
l=0
r=max(a)+1
while r-l>1:
	cnt=0
	mid=(l+r+1)//2
	if mid==0:
		print((1))
		exit()
	for x in a:
		if x>1:
			cnt+=(x-1)//mid
	if cnt<=k:
		r=mid
	else:
		l=mid
print(r)
# Original solution
import heapq
n , k = list(map(int,input().split()))
p = list(map(int,input().split()))
a = []
for i in range(n):
    a.append([-p[i],-p[i],1])
heapq.heapify(a)
for i in range(k):
    now , moto , kazu = heapq.heappop(a)
    heapq.heappush(a,[moto//(kazu+1),moto,kazu+1])
ans = heapq.heappop(a)
print((-ans[0]))

# Optimized solution
import heapq
n , k = list(map(int,input().split()))
a = list(map(int,input().split()))
lef = 0
rig = max(a)
while rig - lef != 1:
    now = -(-(lef+rig)//2)
    cou = 0
    for i in range(n):
        cou += -(-a[i]//now) - 1
    if cou <= k:
        rig = now
    elif cou > k:
        lef = now
print(rig)
# Original solution
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
import copy
a = copy.deepcopy(p)
for i in range(n):
    a[i] = [-a[i],0,i]
import heapq as hp
hp.heapify(a)
for i in range(k):
    s = hp.heappop(a)
    u = [s[0]/2,s[1]+1,s[2]]
    hp.heappush(a, u)
ans = 0
for i in range(n):
    ans = max(-(-p[a[i][2]]//(a[i][1]+1)),ans)
print(ans)

# Optimized solution
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
def test(d,m,u):
    global ans
    p = 0
    for i in range(n):
        if m < a[i]:
            p += a[i]//m
    if u-d <= 1:
        ans = max(ans,m)
        pass
    elif p > k:
        ans = max(ans,m)
        d = m
        m = -(-(m+u)//2)
        test(d,m,u)
    else:
        u = m
        m = -(-(m+d)//2)
        test(d,m,u)
d = 0
m = 1
u = 10**9+7
test(d,m,u)
print(ans)
# Original solution
from math import ceil
from heapq import heapify, heappop, heappush

N, K, *A = list(map(int, open(0).read().split()))

a = [(-i, i, 1) for i in A]
heapify(a)
for _ in range(K):
    i, j, k = heappop(a)
    k += 1
    i = -(j / k)
    heappush(a, (i, j, k))
print((ceil(heappop(a)[0] * -1)))


# Optimized solution
from math import ceil

N, K, *A = list(map(int, open(0).read().split()))

def is_ok(n):
    t = 0
    for a in A:
        if a <= n:
            continue
        t += ceil(a / n) - 1
    return t <= K

ok = 1000000000
ng = 0.0000000001
while abs(ng - ok) > 1:
    m = (ok + ng) // 2
    if is_ok(m):
        ok = m
    else:
        ng = m

print((ceil(ok)))
# Original solution
import math
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k-1>0 and sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1


# Optimized solution
import math
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k==1 or sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1
# Original solution
import math
def possible(l, a, k):
    for x in a:
        k -= math.ceil(x/l)-1
    return k>=0

n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
    mid = (mini+maxi)//2
    if possible(mid, a, k):
        maxi = mid
    else:
        mini = mid + 1
print(mini)


# Optimized solution
import math
def possible(l, a, k):
    for x in a:
        k -= x//l
        if x%l==0:
            k += 1
    return k>=0

n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
    mid = (mini+maxi)//2
    if possible(mid, a, k):
        maxi = mid
    else:
        mini = mid + 1
print(mini)
# Original solution
import copy
import math

N, K = list(map(int,input().split()))
As = list(map(int,input().split()))

sorted_As = sorted(As,reverse = True)
cut_As = copy.copy(sorted_As)
count_list = [0]*len(sorted_As)

for i in range(K):
    index = cut_As.index(max(cut_As))
    count = count_list[index]
    count_list[index] += 1
    cut_As[index] = sorted_As[index] / (count+2)

'''
for i in range(K):
    count = count_list[0]
    count_list[0] += 1
    cut_As[0] = sorted_As[0] / (count+2)
    cut_As,sorted_As,count_list = (list(x) for x in zip(*sorted(zip(cut_As,sorted_As,count_list),reverse = True)))
'''

print((math.ceil(max(cut_As))))


# Optimized solution
def judge(As,K,C):
    count = 0
    for i in range(len(As)):
        if As[i]%C == 0:
            m = As[i]//C - 1
        else:
            m = As[i]//C
        count += m
    if count <= K:
        return True
    else:
        return False

N, K = list(map(int,input().split()))
As = list(map(int,input().split()))

l = 0
r = max(As)
while(r-l>1):
    mid = (l+r)//2
    if judge(As,K,mid):
        r = mid -1
    else:
        l = mid + 1
if judge(As,K,r):
    print(r)
else:
    print((r+1))
# Original solution
import sys
import math
import heapq
push = heapq.heappush
pop = heapq.heappop
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,k = list(map(int,readline().split()))
lst1 = list(map(int,readline().split()))

hp = []
for i in lst1:
    push(hp,(-i,i,1))

for i in range(k):
    res = pop(hp)
    res2 = [0]*3
    res2[0] = -res[1]/(res[2]+1)
    res2[1] = res[1]
    res2[2] = res[2]+1
    push(hp,tuple(res2))

print((math.ceil(-pop(hp)[0])))

# Optimized solution
#揃える長さを決め打って二分探索
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,k = list(map(int,readline().split()))
lst1 = list(map(int,readline().split()))
lst1.sort(reverse=True)
def func(mid): #ここが関数部分
    res = 0
    for i in range(n):
        if mid >= lst1[i]:
            continue
        res += math.ceil(lst1[i]/mid)-1
        if res > k:
            return False
    return True


def binary_search(): #2分探索
    ok = 10**9
    ng = 0
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if func(mid):
            ok = mid
        else:
            ng = mid

    return ok

print((binary_search()))
# Original solution
from fractions import Fraction
from math import ceil, floor

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

def isOk(x):
    cnt = 0
    for a in A:
        cnt += floor(Fraction(a, x))
    return cnt <= K

ok = max(A)
ng = 0
for _ in range(50):
    mid = Fraction(ok + ng, 2)
    if isOk(mid):
        ok = mid
    else:
        ng = mid

print((ceil(ok)))


# Optimized solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

def isOk(x):
    cnt = 0
    for a in A:
        cnt += (a - 1) // x
    return cnt <= K

ok = max(A)
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if isOk(mid):
        ok = mid
    else:
        ng = mid

print(ok)
# Original solution
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    ng = 0
    ok = 10 ** 9 + 1

    while ok - ng > 1:
        mid = (ok + ng) // 2
        ans = sum(list([math.ceil(x / mid) - 1 for x in A]))

        # for i in range(N):
        #     ans += A[i]//mid -1
        #     if A[i]%mid !=0:
        #         ans +=1

        if ans <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()


# Optimized solution
import sys



def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    ng = 0
    ok = 10 ** 9 + 1
    A.sort(reverse=True)

    while ok - ng > 1:
        mid = (ok + ng) // 2
        ans =0
        for i in range(N):
            ans += A[i]//mid -1
            if A[i]%mid !=0:
                ans +=1
            if ans >K:
                break

        if ans <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()
# Original solution
import sys



def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    ng = 0
    ok = 10 ** 9 + 1
    A.sort(reverse=True)

    while ok - ng > 1:
        mid = (ok + ng) // 2
        ans =0
        for i in range(N):
            ans += A[i]//mid -1
            if A[i]%mid !=0:
                ans +=1
            if ans >K:
                break

        if ans <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()


# Optimized solution
import sys



def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    ng = 0
    ok = 10 ** 9 + 1

    while ok - ng > 1:
        mid = (ok + ng) // 2
        ans =0
        for i in range(N):
            ans += A[i]//mid -1
            if A[i]%mid !=0:
                ans +=1
            if ans >K:
                break

        if ans <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()
# Original solution
import heapq
import math

length_heap = []

N, total_cut = list(map(int, input().split()))

length_list = list(map(int, input().split()))
for index, l in enumerate(length_list):
    heapq.heappush(length_heap, (-l, 1, index))

for i in range(total_cut):
    longest, cut_n, idx = heapq.heappop(length_heap)
    heapq.heappush(length_heap, (-length_list[idx]/(cut_n+1), (cut_n + 1), idx))

result = -heapq.heappop(length_heap)[0]

print((math.ceil(result)))


# Optimized solution
import math
N, K = list(map(int, input().split()))

log_list = list(map(int, input().split()))

maxx = 10**9
minx = 0

while (maxx - minx != 1):
    midx = (maxx + minx) // 2
    cut_n = sum([math.ceil(length / midx)-1 for length in log_list])
    if cut_n > K:
        minx = midx
    else:
        maxx = midx


print(maxx)
# Original solution
import heapq 
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [[i, 2] for i in a]
for _ in range(k):
    p = a.index(max(a))
    if b[p][0]%b[p][1] == 0:
        a[p] = b[p][0]//b[p][1]
    else:
        a[p] = b[p][0]//b[p][1] +1
    b[p][1] += 1
print((max(a)))

# Optimized solution
n, k = list(map(int, input().split()))
a = [i-1 for i in map(int, input().split())]

left, right = 0, 10**9
while left < right:
    middle = (left+right)//2
    if middle==0:
        left=1
        break
    count = 0
    for i in a:
        count += i//middle
    
    if count <= k:
        right = middle
    else:
        left = middle + 1

print(left)
# Original solution
n, k = list(map(int, input().split()))
a = [i-1 for i in map(int, input().split())]

left, right = 0, 10**9
while left < right:
    middle = (left+right)//2
    if middle==0:
        left=1
        break
    count = 0
    for i in a:
        count += i//middle
    
    if count <= k:
        right = middle
    else:
        left = middle + 1

print(left)

# Optimized solution
n, k = list(map(int, input().split()))
a = [i-1 for i in map(int, input().split())]

left, right = 1, 10**9
while left < right:
    middle = (left + right)//2

    count = 0
    for i in a:
        count += i//middle
    
    if count <= k:
        right = middle
    else:
        left = middle + 1

print(left)
# Original solution
from math import ceil
n, k, *A = list(map(int, open(0).read().split()))
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
c = k - sum(int(a/t)-1 for a in A)
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print((X[-c-1]))

# Optimized solution
from math import ceil
n, k, *A = list(map(int, open(0).read().split()))
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print((X[sum(int(a/t)-1 for a in A) -k-1]))
# Original solution
import math
N,K=list(map(int,input().split()))
import heapq
A=list(map(int,input().split()))

h=[(-A[i],1) for i in range(len(A))]
heapq.heapify(h)
for i in range(K):
  a=heapq.heappop(h)
  b=a[0]
  c=a[1]
  heapq.heappush(h,(c*b/(c+1),c+1))


ans=heapq.heappop(h)
print((math.ceil(-ans[0])))


# Optimized solution
import math
N,K=list(map(int,input().split()))
import heapq
A=list(map(int,input().split()))

def isok(x):
  c=0
  for i in range(N):
    c+=math.ceil(A[i]/x)-1
  if c<=K:
    return True
  else:
    return False
start=0
end=max(A)
mid=(start+end)//2
while end-start>1:
  mid=(start+end)//2
  if isok(mid)==True:
    end=mid
  else:
    start=mid
print(end)