CodeEff/ECCO huggingface dataset:
# Original solution
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
lo = 1
hi = 10**18
ans = max(arr)
while lo<=hi:
    t = 0
    m = (hi+lo)//2
    for i in range(n):
        if arr[i]>m:
            req = arr[i]//m
        else:
            req=  0
        t+=req
    if t<=k:
        ans = m
        hi = m-1
    else:
        lo = m+1
print(ans)

# Optimized solution
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
lo = 1
hi = 10**12
ans = max(arr)
while lo<=hi:
    t = 0
    m = (hi+lo)//2
    for i in range(n):
        if arr[i]>m:
            req = arr[i]//m
        else:
            req=  0
        t+=req
    if t<=k:
        ans = m
        hi = m-1
    else:
        lo = m+1
print(ans)
# Original solution
import math
import bisect

N, K = list(map(int, input().split()))
leng = list(map(int, input().split()))
leng.sort()
cut = [0] * N
# A = [maruta(a, 0) for a in A_tmp]
for a in range(K):
    new_cut = cut.pop() + 1
    new_leng = leng.pop() * (new_cut / (new_cut + 1))
    idx = bisect.bisect_left(leng, new_leng)
    leng.insert(idx, new_leng)
    cut.insert(idx, new_cut)
    # print(new_leng, new_cut)
print((math.ceil(leng[-1])))


# Optimized solution
import math

def check(d):
    cut_num = 0
    for i in leng:
        cut_num += math.ceil(i / d) - 1
    if cut_num <= K:
        return True
    return False


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

d_min = 0
d_max = max(leng)
d = math.ceil(d_max / 2)

while d_max - d_min > 1:
    if check(d):
        d_max = d
        d = math.ceil((d_max + d_min) / 2)
    else:
        d_min = d
        d = int((d_max + d_min) / 2)
    # print(d, d_max, d_min)

print(d_max)
# Original solution
def main():
    n,k = list(map(int,input().split()))
    A = list(map(int,input().split()))

    left = 0
    right = max(A)

    while abs(right-left)>1:
        cent = (right+left)//2
        
        ct = 0
        for a in A:
            ct+=(a-0.1)//cent
        
        if ct <= k:
            right=cent
        else:
            left=cent
    
    print(right)
main()

# Optimized solution
def main():
    n,k = list(map(int,input().split()))
    A = list(map(int,input().split()))

    left = 0
    right = max(A)

    while abs(right-left)>1:
        cent = (right+left)//2
        
        ct = 0
        for a in A:
            ct+=a//cent
            if a%cent==0:
                ct-=1
        
        if ct <= k:
            right=cent
        else:
            left=cent
    
    print(right)
main()
# Original solution
from math import ceil

def BinarySearch(x):
    ans = sum([ceil(a/x)-1 for a in A])
    if ans <= K:
        return True
    else:
        return False

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

r = max(A)
l = 0
eps = 10**-7

while abs(r-l) > eps:

    m = (r+l)/2

    if BinarySearch(m):
        r = m
    else:
        l = m

print((ceil(r))) 


# Optimized solution
from math import ceil

def BinarySearch(x):
    ans = sum([ceil(a/x)-1 for a in A])
    if ans <= K:
        return True
    else:
        return False

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

r = max(A)
l = 0
eps = 10**-6

while abs(r-l) > eps:

    m = (r+l)/2

    if BinarySearch(m):
        r = m
    else:
        l = m

print((ceil(r)))
# Original solution
from heapq import heappush, heappop
from math import ceil
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]

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

# Optimized solution
from heapq import heappush, heappop
from math import ceil, floor
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]

ng, ok = 0, 10 ** 9
for _ in range(50) :
  mid = (ng + ok) / 2
  ret = 0
  for a in A :
    ret += floor(a / mid)
  if ret <= K :
    ok = mid
  else :
    ng = mid
    
print((ceil(ng)))
# Original solution
n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1<<32 # (ng,ok] = (l,r]
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A: c += (a-1) // m
    if c <= k: ok = m
    else: ng = m
print(ok)


# Optimized solution
n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1<<30 # (ng,ok] = (l,r]
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A: c += (a-1) // m
    if c <= k: ok = m
    else: ng = m
print(ok)
# Original solution
n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
ng, ok = 0, 1<<30
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A:
        d = (a - 1) // m
        if d == 0: break
        c += d
    if c <= k: ok = m
    else: ng = m
print(ok)


# Optimized solution
_, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1<<30
while ok - ng > 1:
    m = (ng + ok) // 2
    if k < sum([(a-1)//m for a in A]): ng = m
    else: ok = m
print(ok)
# Original solution
# -*- coding: utf-8 -*-
import sys
from decimal import Decimal, ROUND_HALF_UP


def main():
    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))


    def check(length :int) -> bool:
        cnt = 0

        for a in A_list:
            if a >= length:
                quotient = a / length
                divide = -(-quotient // 1)  # round up
                cnt += (divide - 1)
        
        return (True if cnt <= K else False)


    L = 0.1            # the minimum length
    R = max(A_list)  # the maximum length

    while (R - L) > 0.01:
        M = L + (R - L) / 2

        if check(M):
            R = M
        else:
            L = M
    
    
    ans = float( Decimal(str(M)).quantize(Decimal('1E-1'), rounding=ROUND_HALF_UP) )
    ans = -(-ans // 1)  # round up
    print(( int(ans) ))


if __name__ == "__main__":
    main()


# Optimized solution
# -*- coding: utf-8 -*-
import sys
from decimal import Decimal, ROUND_HALF_UP


def main():
    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))


    def check(length :int) -> bool:
        cnt = 0

        for a in A_list:
            if a >= length:
                quotient = a / length
                divide = -(-quotient // 1)  # round up
                cnt += (divide - 1)
        
        return (True if cnt <= K else False)


    L = 0            # the minimum length
    R = max(A_list)  # the maximum length

    while (R - L) > 1:
        M = L + (R - L) // 2

        if check(M):
            R = M
        else:
            L = M


    print(R)


if __name__ == "__main__":
    main()
# Original solution
# -*- coding: utf-8 -*-
import sys
from decimal import Decimal, ROUND_HALF_UP


def main():
    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))


    def check(length :int) -> bool:
        cnt = 0

        for a in A_list:
            if a >= length:
                quotient = a / length
                divide = -(-quotient // 1)  # round up
                cnt += (divide - 1)
        
        return (True if cnt <= K else False)


    L = 0            # the minimum length
    R = max(A_list)  # the maximum length

    while (R - L) > 1:
        M = L + (R - L) // 2

        if check(M):
            R = M
        else:
            L = M


    print(R)


if __name__ == "__main__":
    main()


# Optimized solution
# -*- coding: utf-8 -*-
import sys
import math


def main():
    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))


    def check(length :int) -> bool:
        cnt = 0

        for a in A_list:
            if a >= length:
                quotient = a / length
                #divide = -(-quotient // 1)  # round up
                divide = math.ceil(quotient)  # round up
                cnt += (divide - 1)
        
        return (True if cnt <= K else False)


    L = 0            # the minimum length
    R = max(A_list)  # the maximum length

    while (R - L) > 1:
        M = L + (R - L) // 2

        if check(M):
            R = M
        else:
            L = M


    print(R)


if __name__ == "__main__":
    main()
# Original solution
from heapq import heappush, heappop, heapify

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


def check(x):
    # 最長の丸太をx以下にできるか
    # 任意の丸太をx以下にできるか
    cnt = 0
    for ai in a:
        if ai > x:
            if ai % x == 0:
                cnt += ai // x - 1
            else:
                cnt += ai // x
    # print('check', x, cnt)
    return cnt <= k


lb = 0  # False
ub = max(a)  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    # print(mid, check(mid))
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)


# Optimized solution
from heapq import heappush, heappop, heapify

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


def check(x):
    # 最長の丸太をx以下にできるか
    # 任意の丸太をx以下にできるか
    cnt = sum([(ai - 1) // x for ai in a])
    return cnt <= k


lb = 0  # False
ub = max(a)  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    # print(mid, check(mid))
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)
# Original solution
import heapq
import math

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

H = []

for i in range(n):
    heapq.heappush(H, (-A[i], 1))

for i in range(k):
    int, num = heapq.heappop(H)
    heapq.heappush(H, (int*num/(num+1), num+1) )

print((math.ceil(-H[0][0])))

# Optimized solution
import math

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

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += math.ceil(A[i]//mid)

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)
# Original solution
import math

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

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += math.ceil(A[i]/mid-1)

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)


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

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += A[i]//mid

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)
# Original solution
import heapq

ceil = lambda a, b: (a + b - 1) // b

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

h = [(-a, a, 1) for a in A]
heapq.heapify(h)
for _ in range(K):
    l, a, ct = heapq.heappop(h)
    ct += 1
    heapq.heappush(h, (-a / ct, a, ct))
_, a, ct = heapq.heappop(h)
print((ceil(a, ct)))


# Optimized solution
ceil = lambda a, b: (a + b - 1) // b

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

# bisect
l, r = 0, max(A)
while r - l > 1:
    m = (l + r) // 2
    if sum(ceil(x, m) - 1 for x in A) > K:
        l = m
    else:
        r = m
print(r)
# Original solution
import math

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

Z = []
for i in range(N):
    ver = [A[i], 0]
    Z.append(ver)

for k in range(K):
    h = Z.index(max(Z))
    Z[h][1] += 1
    Z[h][0] /= 2 

for j in range(N):
    A[j] = A[j]/(Z[j][1]+1)

print((math.ceil(max(A))))

# Optimized solution
import math

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

def ink(L):
    cnt = 0
    for i in range(N):
        cnt += A[i]//L
        if A[i]%L != 0:
            cnt += 1
        cnt -= 1
    return cnt <= K

bottom, top = 0, max(A)

while(top - bottom > 1):
    middle = (top + bottom) // 2
    if ink(middle): top = middle
    else: bottom = middle

print(top)
# Original solution
def main():
    from math import ceil

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

    def binary_search(*, ok, ng, func):
        for _ in range(80):
            mid = (ok + ng) / 2
            if func(mid):
                ok = mid
            else:
                ng = mid
        return ok

    def is_ok(mid):
        cnt = 0
        for x in A:
            cnt += x // mid
            if x % mid == 0:
                cnt -= 1
        return cnt <= K

    ma = max(A)
    res = binary_search(ok=ma, ng=0, func=is_ok)

    print((ceil(res)))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    from math import ceil

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

    def binary_search(*, ok, ng, func):
        for _ in range(60):
            mid = (ok + ng) / 2
            if func(mid):
                ok = mid
            else:
                ng = mid
        return ok

    def is_ok(mid):
        cnt = 0
        for x in A:
            q, r = divmod(x, mid)
            cnt += q
            if r == 0:
                cnt -= 1
        return cnt <= K

    ma = max(A)
    res = binary_search(ok=ma, ng=0, func=is_ok)

    print((ceil(res)))


if __name__ == '__main__':
    main()
# Original solution
from heapq import heapify,heappop,heappush
from math import ceil

def solve(A,N,K):
    ans_max,ans_min = max(A),1

    while True:
        if cutable(A,N,K,(ans_max+ans_min)//2):
            if ans_max > (ans_max+ans_min)//2:
                ans_max = (ans_max+ans_min)//2
            else:
                return ans_max
        else:
            if ans_min < (ans_max+ans_min)//2:
                ans_min = (ans_max+ans_min)//2
            else:
                return ans_max

def cutable(A,N,K,div):
    #K回までの切断で全部を長さdiv以下にできるかどうか
    cnt = 0
    for i in range(N):
        cnt += A[i]//div
        if A[i] % div == 0:
            cnt -= 1
        if cnt > K:
            return False

    return True

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

    ans = solve(A,N,K)
    print(ans)

if __name__ == "__main__":
    main()


# Optimized solution
from heapq import heapify,heappop,heappush

def solve(A,N,K):
    ans_max,ans_min = max(A),1

    while True:
        if cutable(A,N,K,(ans_max+ans_min)//2):
            if ans_max > (ans_max+ans_min)//2:
                ans_max = (ans_max+ans_min)//2
            else:
                return ans_max
        else:
            if ans_min < (ans_max+ans_min)//2:
                ans_min = (ans_max+ans_min)//2
            else:
                return ans_max

def cutable(A,N,K,div):
    #K回までの切断で全部を長さdiv以下にできるかどうか
    cnt = 0
    for i in range(N):
        cnt += A[i]//div
        if A[i] % div == 0:
            cnt -= 1
        if cnt > K:
            return False

    return True

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

    ans = solve(A,N,K)
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = 2*(10**9)
treeLen = len(tree)

while right - left > 1:
    cnt = 0
    mid = (right + left) // 2
    for i in range(treeLen):
        cnt += tree[i] // mid
        if tree[i] % mid == 0:
            cnt -= 1  # ちょうどに切れるときは切り口が1減る
    if K >= cnt:
        right = mid
    else:
        left = mid

print(right)


# Optimized solution
N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = max(tree)

while right - left > 1:
    cnt = 0
    mid = (right + left) // 2
    for i in tree:
        cnt += i // mid
        if i % mid == 0:
            cnt -= 1  # ちょうどに切れるときは切り口が1減る
    if K >= cnt:
        right = mid
    else:
        left = mid

print(right)
# Original solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))

ll=0
rr=10**9+1
for _ in range(10**3):
  #最も長い丸太がこれになる
  ans=(ll+rr)/2.0
  cnt=0
  for item in a:
    if item>ans:
	    cnt+=((-1*item)//ans)*(-1)-1
  if cnt<=k:
    rr=ans
  else:
    ll=ans
print((int((-1*ans//1)*(-1))))

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

ll=0
rr=10**9+1
for _ in range(10**2):
  #最も長い丸太がこれになる
  ans=(ll+rr)/2.0
  cnt=0
  for item in a:
    if item>ans:
	    cnt+=((-1*item)//ans)*(-1)-1
  if cnt<=k:
    rr=ans
  else:
    ll=ans
print((int((-1*ans//1)*(-1))))
# Original solution
n,k = list(map(int,input().split()))
l = list(map(int,input().split()))

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
for i in range(100):
    mid = (lb + ub) / 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

import math
ans = math.ceil(ub)
print(ans)

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

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
while ub-lb > 1:
    mid = (lb + ub + 1) // 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

print(ub)
# Original solution
n,k = list(map(int,input().split()))
l = list(map(int,input().split()))

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
while ub-lb > 1:
    mid = (lb + ub + 1) // 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

print(ub)

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

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
while ub-lb > 1:
    mid = (lb + ub) // 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

print(ub)
# Original solution
from math import ceil
# from decimal import Decimal

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# N, K = 2*10**5, 1
# A = [10**9]*N

def solve(x):
    m = 0
    for a in A:
        m += a//x - (a%x == 0)
    # print(x, m)
    return m <= K

A = [a*10**10 for a in A]

ok, ng = max(A), 0
while abs(ok-ng > 1):
    mid = (ok+ng)//2
    # print(mid)
    if solve(mid):
        ok = mid
    else:
        ng = mid

print((-(-mid//10**10)))

# Optimized solution
BIG = 10**10

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# N, K = 2*10**5, 2*10**5
# A = [10**9]*N

def solve(x):
    m = 0
    for a in A:
        m += -(-(a//x))
    # print(x, m)
    return m > K

A = [a*BIG for a in A]

# c = 0
ok, ng = 0, max(A)
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    # print(mid)
    if solve(mid):
        ok = mid
    else:
        ng = mid
    # c += 1

# print(c)

print((-(-ok//BIG)))
# Original solution
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
y = 0
r = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, y, a[i]/(y+1), a[i]]
    r += y
x.sort(key= lambda val : val[2],reverse=True)
for i in range(k-r):
    x[i][1] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][3]/(x[i][1]+1))
print((int(-(-ans//1))))


# Optimized solution
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
t = 0
for i in range(n):
    y = int(a[i]/s * k)
    x[i] = [i, a[i], y, a[i]/(y+1)]
    t += y
x.sort(key= lambda val : val[3],reverse=True)
for i in range(k-t):
    x[i][2] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][1]/(x[i][2]+1))
print((int(-(-ans//1))))
# Original solution
#import numpy as np
#import collections
#import math

#f = open('./input_E.txt')
#
#N,K = map(int, f.readline().split())
#A = list(map(int, f.readline().split()))

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

if K == 0:
    ans = max(A)
else:
    A.sort(reverse=True)
    
    All_length = sum(A)
    KK = K+N-1
    lm = All_length/(KK+1)
    
    k_list = [int(Ai//lm) for Ai in A]
    X_list = [Ai%lm for Ai in A]
    
    sum_k = sum(k_list)
    res_cut = KK-sum_k
    
    zero_k = 0
    for i in range(1,N+1):
        if k_list[-i] == 0:
            zero_k +=1
        else:
            break
    
    if res_cut > 0:
        ans_kouho = []
        for i in range(-zero_k,0):
            ans_kouho.append(X_list[i])
        for i in range(res_cut):
            for j in range(N-zero_k):
                ans_kouho.append((X_list[j]-i*lm)/k_list[j])
        
        ans_kouho.sort(reverse=True)
        ans = ans_kouho[res_cut] + lm
        ans = int(ans)+1
    else:
        ans = int(lm)+1
print(ans)

# Optimized solution
#import numpy as np
#import collections
#import math

#f = open('./input_E.txt')
#
#N,K = map(int, f.readline().split())
#A = list(map(int, f.readline().split()))

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

A.sort(reverse=True)

def nibu(small,big,KK,AA):
    mid = (small+big)//2
    k_list = [(x-1)//mid for x in AA]
    sum_k = sum(k_list)
    if sum_k <= KK: #達成可能 -> 答えはもっと小さい
        return small,mid # 不可能,可能
    else:
        return mid,big # 不可能,可能


if K==0:
    ans = A[0]
else:    
    lmin = 0
    lmax = A[0]
    
    while lmax - lmin >= 2:
        lmin, lmax = nibu(lmin,lmax,K,A)
    
    ans = lmax
    
print(ans)
# Original solution
from heapq import heapify, heappop, heappush
from math import ceil

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

b = []
for v in a:
    b.append([-v, -v, 1])

heapify(b)
for _ in range(k):
    x, y, z = heappop(b)
    heappush(b, [y/(z+1), y, z+1])

res = heappop(b)
print((ceil(-res[0])))

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

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)
# Original solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)

# Optimized solution
def binary_search(key):
    '''
    条件を満たす最小のindexを求める
    '''
    right = 10 ** 9 + 1
    left = 0
    while right - left > 1:
        mid = (right + left) // 2

        cnt = 0
        for v in a:
            cnt += (v + mid - 1) // mid - 1

        if cnt <= key:
            right = mid
        else:
            left = mid
    
    return right


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

print((binary_search(k)))
# Original solution
def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    '''
    ok = 10 ** 9  # 条件を満たすindexの上限値/下限値
    ng = 0        # 条件を満たさないindexの下限値-1/上限値+1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        cnt = 0
        for v in a:
            cnt += (v + mid - 1) // mid - 1

        if cnt <= key:  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


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

print((binary_search(k)))

# Optimized solution
# Binary Search

def isOK(i, key):
    '''
    問題に応じて返り値を設定
    '''
    cnt = 0
    for v in a:
        cnt += (v + i - 1) // i - 1

    return cnt <= key


def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    O(logN)
    '''
    ok = 10 ** 9  # 条件を満たすindexの上限値/下限値
    ng = 0        # 条件を満たさないindexの下限値-1/上限値+1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        if isOK(mid, key):  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


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