We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.

-----Constraints-----
 - 1 \leq N \leq 2 \times 10^5
 - 0 \leq K \leq 10^9
 - 1 \leq A_i \leq 10^9
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N K
A_1 A_2 \cdots A_N

-----Output-----
Print an integer representing the answer.

-----Sample Input-----
2 3
7 9

-----Sample Output-----
4

 - First, we will cut the log of length 7 at a point whose distance from an end of the log is 3.5, resulting in two logs of length 3.5 each.
 - Next, we will cut the log of length 9 at a point whose distance from an end of the log is 3, resulting in two logs of length 3 and 6.
 - Lastly, we will cut the log of length 6 at a point whose distance from an end of the log is 3.3, resulting in two logs of length 3.3 and 2.7.
In this case, the longest length of a log will be 3.5, which is the shortest possible result. After rounding up to an integer, the output should be 4.

Difficulty: MEDIUM

Solutions:
import sys
(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
(l, r) = (0, max(a))
while r - l > 1:
	t = (l + r) // 2
	c = sum([(e - 1) // t for e in a])
	if k < c:
		l = t
	else:
		r = t
print(r)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
(x, y) = (0, 10 ** 9)
while y > x + 1:
	m = (x + y) // 2
	c = 0
	for i in l:
		c += (i - 1) // m
	if c <= k:
		y = m
	else:
		x = m
print(y)


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

def judge(ans, K, A):
	cut = 0
	for i in range(len(A)):
		cut += (A[i] - 1) // ans
	if cut > K:
		return False
	else:
		return True
ansp = max(A)
ansm = 0
ans = (ansp + ansm) // 2
d = 1
while ansp - ansm > d:
	if judge(ans, K, A):
		ansp = ans
	else:
		ansm = ans
	ans = (ansp + ansm) // 2
print(ansp)


import sys
input = sys.stdin.readline
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = 2 * 10 ** 9
while r - l > 1:
	m = (l + r) // 2
	count = 0
	for a in A:
		count += (a + m - 1) // m - 1
	if count <= K:
		r = m
	else:
		l = m
print(r)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
l = 0
r = max(arr)
while l + 1 < r:
	m = (l + r) // 2
	cut = 0
	for x in arr:
		cut += (x - 1) // m
	if cut > k:
		l = m
	else:
		r = m
print(r)


import heapq
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
ok = 10 ** 9
ng = 0
while abs(ng - ok) > 1:
	m = (ok + ng) // 2
	cou = 0
	for i in a:
		cou += (i + m - 1) // m - 1
	if cou <= k:
		ok = m
	else:
		ng = m
print(ok)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 1000000000.0 + 5
while l + 1 != r:
	m = (l + r) // 2
	cnt = 0
	for x in a:
		cnt += (x - 1) // m
	if cnt <= k:
		r = m
	else:
		l = m
print(int(r))


def f(m):
	cut = 0
	for aa in a:
		cut += (aa - 1) // m
		if cut > k:
			return False
	return True
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9 + 1
while r - l > 1:
	m = (l + r) // 2
	if f(m):
		r = m
	else:
		l = m
print(r)


(n, k, *aa) = map(int, open(0).read().split())
imp = 0
psbl = 10 ** 9
while psbl - imp > 1:
	mid = (psbl + imp) // 2
	cost = sum((0 - -a // mid - 1 for a in aa))
	if cost <= k:
		psbl = mid
	else:
		imp = mid
print(psbl)


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

def isOK(x):
	cnt = 0
	for a in A:
		cnt += (a + x - 1) // x - 1
	return cnt <= K
(left, right) = (0, 10 ** 10)
while right - left > 1:
	mid = (left + right) // 2
	if isOK(mid):
		right = mid
	else:
		left = mid
print(right)


import numpy as np

def solve(*args: str) -> str:
	(n, k) = list(map(int, args[0].split()))
	A = np.array(tuple(map(int, args[1].split())))
	(l, r) = (0, np.max(A))
	while l + 1 < r:
		m = (l + r) // 2
		if k < np.sum(np.ceil(A / m) - 1):
			l = m
		else:
			r = m
	return str(r)

def __starting_point():
	print(solve(*open(0).read().splitlines()))
__starting_point()


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))

def c(x):
	cnt = 0
	for i in a:
		cnt += i // x
	return cnt <= k
(l, r) = (0, max(a))
for i in range(100):
	mid = (l + r) / 2
	if c(mid):
		r = mid
	else:
		l = mid
print(ceil(l))


from math import floor, ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
l = 0
r = max(a)
while r - l > 1:
	c = (l + r) // 2
	cnt = 0
	for i in a:
		cnt += max(ceil(i / c) - 1, 0)
	if cnt <= k:
		r = c
	else:
		l = c
print(r)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
l = 1
h = a[0]
while l != h:
	m = (l + h) // 2
	cut = 0
	for x in a:
		cut += x // m + (x % m != 0) - 1
	if cut <= k:
		h = m
	else:
		l = m + 1
print(l)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = max(a)
while r - l > 1:
	c = (l + r) // 2
	t = 0
	for ai in a:
		t += (ai + c - 1) // c - 1
	if t <= k:
		r = c
	else:
		l = c
print(r)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
M = max(A)
(l, r) = (1, M)
cnt = 0
while l <= r:
	cnt = 0
	mid = (l + r) // 2
	for a in A:
		tmp = a // mid if a > mid else 0
		cnt += tmp
	if cnt <= k:
		r = mid - 1
	else:
		l = mid + 1
print(l)


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

def main():
	(l, r) = (0, 10 ** 9)
	while r - l > 1:
		m = (l + r) // 2
		if f(m):
			r = m
		else:
			l = m
	print(r)
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
main()


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
left = 0
right = 10 ** 10
while right - left > 1:
	cut = 0
	mid = left + (right - left) // 2
	for a in A:
		cut += (a + mid - 1) // mid - 1
	if cut <= K:
		right = mid
	else:
		left = mid
print(right)


(N, K) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
M = max(A)
m = 1
mid = (M + 1) // 2
while m < M:
	n = 0
	for a in A:
		n += -(-a // mid) - 1
		if n > K:
			m = mid + 1
			break
	else:
		M = mid
	mid = (M + m) // 2
print(mid)


(n, k) = map(int, input().split())
A = list(map(int, input().strip().split()))
b = 0
e = max(A)
L = e // 2
while e - b > 1:
	L = (e + b) // 2
	m = sum(list(map(lambda x: (x - 1) // L, A)))
	if m <= k:
		e = L
	else:
		b = L
print(e)


def judge(A, x, k):
	ans = 0
	for a in A:
		ans += a // x
		if a % x == 0:
			ans -= 1
		if ans > k:
			return False
	return True
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = max(A)
while r - l != 1:
	x = (r + l) // 2
	if judge(A, x, k):
		r = x
	else:
		l = x
print(r)


import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda : sys.stdin.readline().strip()
NI = lambda : int(input())
NMI = lambda : map(int, input().split())
NLI = lambda : list(NMI())
SI = lambda : input()

def main():
	(N, K) = NMI()
	A = NLI()
	ng = 0
	ok = 10 ** 9 + 10
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		cut = 0
		for a in A:
			if a % mid == 0:
				cut += math.floor(a / mid) - 1
			else:
				cut += math.floor(a / mid)
		if cut <= K:
			ok = mid
		else:
			ng = mid
	print(ok)

def __starting_point():
	main()
__starting_point()


def check(x):
	ret = 0
	for e in a:
		ret += max((e - 1) // x, 0)
	return ret <= k
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9
while r - l > 1:
	m = (l + r) // 2
	if check(m):
		r = m
	else:
		l = m
print(r)


(n, k) = map(int, input().split())
A = [int(i) for i in input().split()]
ng = 0
ok = max(A)
while ng + 1 != ok:
	mid = (ok + ng) // 2
	ans = 0
	for i in A:
		ans += 0 - -i // mid - 1
	if ans <= k:
		ok = mid
	else:
		ng = mid
print(ok)


(N, K) = map(int, input().split())
X = list(map(int, input().split()))
ub = 10 ** 9 + 7
lb = 0
while ub - lb > 1:
	mid = (ub + lb) // 2
	cnt = 0
	for v in X:
		cnt += -(-v // mid) - 1
	if cnt <= K:
		ub = mid
	else:
		lb = mid
print(ub)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
right = max(a)
left = 0

def cutable(a, x):
	count = 0
	for i in a:
		count += math.ceil(i / x) - 1
	return count <= k
while right > left + 1:
	mid = (right + left) // 2
	if cutable(a, mid):
		right = mid
	else:
		left = mid
print(right)


(n, k) = 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)


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

def f(x):
	return sum(((a + x - 1) // x - 1 for a in A))
l = 0
r = 10 ** 9 + 1
while r - l > 1:
	mid = (l + r) // 2
	if f(mid) <= K:
		r = mid
	else:
		l = mid
print(r)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = 10 ** 9
while r - l > 1:
	m = (r + l) // 2
	count = 0
	for i in A:
		if i > m:
			count += i // m
	if count > K:
		l = m
	else:
		r = m
print(r)


(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
(low, high) = (0, max(arr) + 1)
while high - low > 1:
	mid = (high + low) // 2
	curr = 0
	for i in arr:
		curr += (i - 1) // mid
	if curr > k:
		low = mid
	else:
		high = mid
print(high)


(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 0
r = max(A)
while l + 1 < r:
	m = (l + r) // 2
	n = sum([(x - 1) // m for x in A])
	if n > K:
		l = m
	else:
		r = m
print(r)


def main():
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	(L, R) = (0, max(arr))
	while L + 1 < R:
		P = (L + R + 1) // 2
		cnt = 0
		for a in arr:
			if P < a:
				if a % P == 0:
					cnt += a // P - 1
				else:
					cnt += a // P
		if cnt <= k:
			R = P
		else:
			L = P
	print(R)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
ok = 1001001001
ng = 0

def check(x):
	cnt = 0
	for q in a:
		cnt += (q - 1) // x
	return cnt <= k
while ok - ng > 1:
	mid = (ok + ng) // 2
	if check(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, k) = map(int, input().split())
(*a,) = map(int, input().split())
mx = max(a)
mn = 10 ** (-9)
from math import ceil
while mx - mn > 10 ** (-5):
	md = (mx + mn) / 2
	cnt = 0
	for ai in a:
		cnt += ceil(ai / md) - 1
	if cnt <= k:
		mx = md
	else:
		mn = md
print(ceil(mn))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 10
while r > l + 1:
	m = (r + l) // 2
	count = 0
	for i in a:
		if i <= m:
			continue
		count += (i - 1) // m
	if count > k:
		l = m
	else:
		r = m
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(l, r) = (1, 10 ** 9)
while l < r:
	m = (l + r) // 2
	if sum(map(lambda v: (v - 1) // m, a)) > k:
		l = m + 1
	else:
		r = m
print(l)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
mini = 0
maxi = max(A)
while maxi - mini > 1:
	mid = (maxi + mini) // 2
	s = sum((math.ceil(a / mid) - 1 for a in A))
	if s > K:
		mini = mid
	else:
		maxi = mid
print(mini + 1)


(N, M) = input().strip().split()
(n, k) = [int(N), int(M)]
a = list(map(int, input().strip().split()))
le = 0
ri = 10000000000
while ri - le > 1:
	mid = (le + ri) // 2
	num = 0
	for i in a:
		num += (i - 1) // mid
	if num <= k:
		ri = mid
	else:
		le = mid
print(ri)


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:
				divide = math.ceil(a / length)
				cnt += divide - 1
		return True if cnt <= K else False
	L = 0
	R = max(A_list)
	while R - L > 1:
		M = L + (R - L) // 2
		if check(M):
			R = M
		else:
			L = M
	print(R)

def __starting_point():
	main()
__starting_point()


import math
(N, K) = map(int, input().split())
As = list(map(int, input().split()))
r = max(As)
if K == 0:
	print(r)
	exit()
l = 1
while l < r:
	mid = (r + l) // 2
	cnt = 0
	for a in As:
		cnt += math.ceil(a / mid) - 1
	if cnt <= K:
		r = mid
	else:
		l = mid + 1
print(r)


(n, k, *a) = map(int, open(0).read().split())
ok = 10 ** 9
ng = 0
while ok - ng > 1:
	x = ok + ng >> 1
	if -sum((-b // x + 1 for b in a)) > k:
		ng = x
	else:
		ok = x
print(ok)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
ng = 0
ok = max(a) + 1
while ok - ng > 1:
	mid = (ok + ng) // 2
	cur = 0
	for x in a:
		cur += (x - 1) // mid
	if cur > k:
		ng = mid
	else:
		ok = mid
print(ok)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l + 1 < r:
	mid = (l + r) // 2
	cnt = 0
	for a in A:
		if a > mid:
			if a % mid == 0:
				cnt += a // mid - 1
			else:
				cnt += a // mid
	if cnt > K:
		l = mid
	else:
		r = mid
print(r)


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

def ok(arg):
	cnt = 0
	for log in a:
		cnt += -(-log // arg)
		cnt -= 1
	return cnt <= k
(st, en) = (0, max(a))
mid = 0
while en - st > 1:
	mid = (en + st) // 2
	if ok(mid):
		en = mid
	else:
		st = mid
print(en)


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

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

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(meguru_bisect(0, max(A)))


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
low = 0
high = max(A)
while high - low > 1:
	mid = (low + high) // 2
	cnt = 0
	for i in A:
		cnt += (i - 1) // mid
	if cnt > K:
		low = mid
	else:
		high = mid
print(high)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
(l, r) = (1, 10 ** 9 + 1)
while r - l > 1:
	t = (l + r) // 2
	k = sum([(a + t - 2) // (t - 1) - 1 for a in A])
	if K < k:
		l = t
	else:
		r = t
print(l)


from sys import stdin
import numpy as np
(n, k) = list(map(int, stdin.readline().split()))
a = np.array(stdin.readline().split(), dtype=np.int64)
ng = 0
ok = 10 ** 9 + 1
while ok - ng > 1:
	mid = ok + ng >> 1
	if np.sum(0 - -a // mid - 1) <= k:
		ok = mid
	else:
		ng = mid
print(ok)


(_, k) = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
(ng, ok) = (0, 1 << 30)
while ok - ng > 1:
	m = (ng + ok) // 2
	if k < sum((a // m for a in A)):
		ng = m
	else:
		ok = m
print(ok)


import sys
import heapq
import math

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

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

	def is_good(mid, key):
		kk = 0
		for a in A:
			kk += -(-a // mid) - 1
		if kk <= key:
			return True
		else:
			return False

	def bi_search(bad, good, key):
		while good - bad > 1:
			mid = (bad + good) // 2
			if is_good(mid, key):
				good = mid
			else:
				bad = mid
		return good
	print(bi_search(0, 1000000000, k))

def __starting_point():
	main()
__starting_point()


(N, K) = list(map(int, input().split()))
log_ls = list(map(int, input().split()))
Max = max(log_ls)

def less_k(min_length, log_ls=log_ls, K=K):
	times = 0
	for log in log_ls:
		if log % min_length == 0:
			times += log // min_length - 1
		else:
			times += log // min_length
	if times <= K:
		return True
	else:
		return False

def return_min_length():
	r = Max
	l = -1
	while True:
		next_length = (r + l) // 2
		if next_length == 0 or not less_k(next_length):
			l = next_length
		else:
			r = next_length
		if r - l == 1:
			return r
ans = return_min_length()
print(ans)


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

def c(x):
	res = 0
	for b in a:
		res += 0 - -b // x - 1
	return res <= k
ng = 0
ok = 10 ** 10
while ok - ng > 1:
	mid = ok + ng >> 1
	if c(mid):
		ok = mid
	else:
		ng = mid
print(ok)


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

def f(t):
	return sum((i // t if i != t else 0 for i in A)) <= K if t else all((i <= t for i in A))
(l, r) = (-1, 10 ** 10)
while r - l > 1:
	m = (r + l) // 2
	if f(m):
		r = m
	else:
		l = m
print(r)


from math import ceil
(n, k, *aa) = map(int, open(0).read().split())
left = 0
right = max(aa)
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)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9
while r - l > 1:
	m = (l + r) // 2
	s = 0
	for x in a:
		s += (x - 1) // m
	if s <= k:
		r = m
	else:
		l = m
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(l, r) = (10 ** 9, 0)
while l - r > 1:
	t = (l + r) // 2
	if sum(((i - 1) // t for i in a)) > k:
		r = t
	else:
		l = t
print(l)


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

def is_ok(x, a, k):
	b = 0
	for ai in a:
		b += math.ceil(ai / x)
		b -= 1
	if b <= k:
		return True

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid, a, k):
			ok = mid
		else:
			ng = mid
	return ok
print(meguru_bisect(0, max(a)))


(n, k) = 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)


I = lambda : list(map(int, input().split()))
(n, k) = I()
l = I()
low = 1
high = max(l)
while low < high:
	mid = (low + high) // 2
	temp = 0
	for i in l:
		temp += i // mid - (i % mid == 0)
	if temp > k:
		low = mid + 1
	else:
		high = mid
print(low)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
left = 0
right = max(a)
while right - left > 1:
	mid = (right + left) // 2
	tmp = 0
	for i in a:
		tmp += (i - 1) // mid
	if tmp <= k:
		right = mid
	else:
		left = mid
print(right)


from math import floor
m = 0
M = 10 ** 9 + 1
(N, K) = map(int, input().split())
A = list(map(int, input().split()))

def OK(p):
	if sum([(a - 1) // p for a in A]) <= K:
		return True
	else:
		return False
while M - m > 1:
	p = (m + M) // 2
	if OK(p):
		M = p
	else:
		m = p
print(M)


def waru(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
ue = sum(A)
sita = 1
for i in range(50):
	n = (ue + sita) // 2
	L = [waru(i, n) - 1 for i in A]
	if sum(L) > K:
		sita = n
	else:
		ue = n
	if ue == sita:
		print(ue)
		return
	elif ue - sita == 1:
		n = sita
		L = [waru(i, n) - 1 for i in A]
		if sum(L) > K:
			print(n + 1)
			return
		else:
			print(n)
			return


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(l, r) = (0, max(a))

def ok(m):
	cut = 0
	for x in a:
		cut += (x - 1) // m
	return cut <= k
while r - l > 1:
	m = (l + r) // 2
	if ok(m):
		r = m
	else:
		l = m
print(r)


def check(x, A, K):
	import math
	sumA = 0
	for a in A:
		if a > x:
			sumA += math.ceil(a / x) - 1
	if sumA <= K:
		return True
	else:
		return False

def resolve():
	(_, K) = [int(i) for i in input().split()]
	A = [int(i) for i in input().split()]
	ok = max(A)
	ng = -1
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if mid > 0 and check(mid, A, K):
			ok = mid
		else:
			ng = mid
	print(ok)
resolve()


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ok = max(l)
ng = 0

def solve(m):
	s = 0
	for i in l:
		s += -(-i // m) - 1
	return s
while ok - ng > 1:
	m = (ok + ng) // 2
	if k < solve(m):
		ng = m
	else:
		ok = m
print(ok)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
s = 0
t = max(A)
while s + 1 < t:
	m = (s + t) // 2
	temp = 0
	for i in A:
		temp += (i - 1) // m
	if temp <= K:
		t = m
	else:
		s = m
print(t)


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

def f(L):
	res = 0
	for x in A:
		res += (x - 1) // L
	return res
l = 0
r = max(A)
while r - l > 1:
	M = (r + l) // 2
	if f(M) > K:
		l = M
	else:
		r = M
print(r)


(n, k) = map(int, input().split())
A = [*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)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ng = 0
ok = max(A)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	now = 0
	for i in A:
		now += i // mid - 1 if i % mid == 0 else i // mid
	if now > k:
		ng = mid
	else:
		ok = mid
print(ok)


def meg_bisect(ng, ok, func):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok
(n, k, *a) = map(int, open(0).read().split())
print(meg_bisect(0, max(a), lambda x: sum((0 - -b // x - 1 for b in a)) <= k))


def check(lis, k, mid):
	for i in lis:
		if i % mid == 0:
			k += 1
		k -= i // mid
	return k >= 0
(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
(a, b) = (1, max(lis))
ans = b
while a <= b:
	mid = (a + b) // 2
	if check(lis, k, mid):
		ans = mid
		b = mid - 1
	else:
		a = mid + 1
print(ans)


(n, k) = [int(i) for i in input().split()]
woods = [int(i) for i in input().split()]

def k_cut_less_than(k, l, woods):
	kaisuu = 0
	for wood in woods:
		kaisuu += (wood - 1) // l
	if kaisuu <= k:
		return False
	return True
import math

def binary_research(start, end, function):
	if start == end:
		return start
	middle = math.ceil((start + end) / 2)
	if function(k, middle, woods):
		start = middle
	else:
		end = middle - 1
	return binary_research(start, end, function)
start = 0
end = 10 ** 9
print(binary_research(start, end, k_cut_less_than) + 1)


(n, k) = map(int, input().split())
A = [*map(int, input().split())]
(ng, ok) = (0, 1 << 32)
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)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9 + 1
ref = 0
while r - l > 1:
	now = (l + r) // 2
	for i in a:
		ref += 0 - -i // now - 1
	if ref <= k:
		ref = 0
		r = now
	else:
		ref = 0
		l = now
print(r)


from math import ceil

def check(x):
	cnt = 0
	for a in A:
		cnt += ceil(a / x) - 1
	return cnt <= K
(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
left = 0
right = max(A)
while left < right - 1:
	mid = (left + right) // 2
	if check(mid):
		right = mid
	else:
		left = mid
print(right)


def fun(X_high, X_low, K, line):
	X = (X_high + X_low) // 2
	cnt = 0
	for tree in line:
		if tree <= X:
			continue
		else:
			(q, r) = divmod(tree, X)
			if r == 0:
				q -= 1
			cnt += q
	if cnt > K:
		X_low = X
	else:
		X_high = X
	return (X_high, X_low)
(N, K) = map(int, input().split(' '))
line = list(map(int, input().split(' ')))
X_high = max(line)
X_low = 0
while X_high - X_low > 1:
	(X_high, X_low) = fun(X_high, X_low, K, line)
print(X_high)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 0
r = a[-1]
while r - l > 1:
	cnt = 0
	m = (l + r) // 2
	for i in a:
		cnt += (i - 1) // m
	if cnt <= k:
		r = m
	else:
		l = m
print(r)


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

def is_ok(arg):
	cnt = 0
	for i in alist:
		cnt += (i - 1) // arg
	return cnt <= k

def nibun(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(nibun(0, 10 ** 9 + 1))


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)
				cnt += divide - 1
		return True if cnt <= K else False
	L = 0.1
	R = max(A_list)
	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)
	print(int(ans))

def __starting_point():
	main()
__starting_point()


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

def is_ok(l):
	cnt = 0
	for L in a:
		cnt += -(-L // l) - 1
	return cnt <= k

def bisect(top, bot):
	while top - bot > 1:
		mid = (top + bot) // 2
		if is_ok(mid):
			top = mid
		else:
			bot = mid
	return top
print(bisect(max(a), 0))


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

def flag(mid):
	count = 0
	for a0 in a:
		count += math.ceil(a0 / mid) - 1
	if count <= k:
		return True
	else:
		return False

def cal(i, j):
	while abs(i - j) > 1:
		mid = (i + j) // 2
		if flag(mid):
			j = mid
		else:
			i = mid
	print(j)
cal(0, max(a))


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

def c(x):
	cnt = 0
	for i in a:
		cnt += (i - 1) // x
	return cnt <= k
(l, r) = (0, max(a))
while l + 1 < r:
	mid = (l + r) // 2
	if c(mid):
		r = mid
	else:
		l = mid
print(r)


(N, K) = map(int, input().split())
As = sorted(map(int, input().split()))
ng = 0
ok = 1001001001
while ok - ng > 1:
	mid = (ng + ok) // 2
	count = 0
	for A in As:
		count += -(-A // mid)
		count -= 1
	if count <= K:
		ok = mid
	else:
		ng = mid
print(ok)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
a = 0
b = 10 ** 9 + 1
while a + 1 < b:
	mid = (a + b) // 2
	ans = 0
	for i in A:
		ans += (i - 1) // mid
	if K < ans:
		a = mid
	else:
		b = mid
print(b)


from math import ceil
(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))

def f(x):
	cnt = 0
	for a in A:
		cnt += ceil(a / x) - 1
	return True if cnt <= K else False
(OK, NG) = (10 ** 9, 0)
while OK - NG > 1:
	mid = (OK + NG) // 2
	if f(mid):
		OK = mid
	else:
		NG = mid
print(OK)


from bisect import bisect
import math
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
(l, r) = (0, max(A))
while l < r - 1:
	mid = (l + r) // 2
	cnt = 0
	for a in A:
		cnt += math.ceil(a / mid) - 1
	if cnt <= k:
		r = mid
	else:
		l = mid
print(r)


(_, k) = map(int, input().split())
A = [*map(int, input().split())]
(ng, ok) = (0, 1 << 30)
while ok - ng > 1:
	m = (ng + ok) // 2
	if k < sum(map(lambda a: (a - 1) // m, A)):
		ng = m
	else:
		ok = m
print(ok)


from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())

def readInts():
	return list(map(int, input().split()))

def readChar():
	return input()

def readChars():
	return input().split()
(n, k) = readInts()
a = readInts()
a.sort(reverse=True)
if n == 1:
	print(math.ceil(a[0] / (k + 1)))
	return

def get(left, right):
	l = (right - left) // 2 + left
	ans = 0
	for i in a:
		ans += math.ceil(i / l) - 1
	return (ans, l)

def nibu(left, right):
	(ans, l) = get(left, right)
	if left < right:
		if ans <= k:
			return nibu(left, l)
		else:
			return nibu(l + 1, right)
	else:
		return right
print(nibu(1, a[0]))


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(l, r) = (0, 10 ** 9)
f = 0
while r - l > 1:
	m = (l + r) // 2
	count = 0
	for i in a:
		count += math.ceil(i / m) - 1
	if count <= k:
		r = m
	else:
		l = m
print(r)


def check(List, mid):
	tmp = 0
	for l in List:
		tmp += -(-l // mid) - 1
	return tmp
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
lo = 0
hi = max(a) + 1
while hi - lo > 1:
	mid = (lo + hi) // 2
	if check(a, mid) <= k:
		hi = mid
	else:
		lo = mid
print(hi)


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

	def value(v):
		cnt = 0
		for i in a:
			cnt += (i - 1) // v
		if cnt > k:
			return False
		else:
			return True

	def b_search(ok, ng, value):
		while abs(ok - ng) > 1:
			mid = (ok + ng) // 2
			if value(mid):
				ok = mid
			else:
				ng = mid
		return ok
	print(b_search(10 ** 16, 0, value))
main()


def solve(*args: str) -> str:
	(n, k) = list(map(int, args[0].split()))
	A = tuple(map(int, args[1].split()))
	(l, r) = (1, max(A))
	while 0.1 < r - l:
		m = (l + r) / 2
		cnt = 0
		for a in A:
			cnt += -int(-a // m) - 1
		if k < cnt:
			l = m
		else:
			r = m
	return str(-int(-l // 1))

def __starting_point():
	print(solve(*open(0).read().splitlines()))
__starting_point()


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
L = 0
R = 10 ** 9
while R - L > 1:
	M = L + R >> 1
	C = 0
	for i in A:
		C += (i - 1) // M
	if C <= K:
		R = M
	else:
		L = M
print(R)


(N, K) = map(int, input().split())
l = list(map(int, input().split()))
import math

def f(n):
	A = 0
	for i in l:
		A += math.ceil(i / n) - 1
	return A <= K

def bis(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if f(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(bis(0, max(l)))


(N, K) = map(int, input().split())
Alist = list(map(int, input().split()))
left = 0
right = max(Alist)
while right - left > 1:
	mid = (left + right) // 2
	cnt = 0
	for A in Alist:
		if A % mid == 0:
			cnt += A // mid - 1
		else:
			cnt += A // mid
	if cnt <= K:
		right = mid
	else:
		left = mid
print(right)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 1
r = max(A)
while l != r:
	mid = (r + l) // 2
	count = 0
	for log in A:
		count += (log - 1) // mid
	if count <= K:
		r = mid
	else:
		l = mid + 1
print(r)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(l, r) = (0, max(a))
while 1 < r - l:
	m = (l + r) // 2
	c = 0
	for i in a:
		c += math.ceil(i / m) - 1
	if c > k:
		l = m
	else:
		r = m
print(r)


(N, K) = map(int, input().split())
A = list(map(float, input().split()))
low = 0
high = 10 ** 9 + 1
while high - low != 1:
	mid = (high + low) // 2
	cut_temp = 0
	ans = -1
	for a in A:
		cut_temp += -(-a // mid) - 1
	if cut_temp > K:
		low = mid
	else:
		high = mid
print(high)


import math
(n, k) = map(int, input().split())
a = tuple(map(int, input().split()))
l = 0
r = max(a)
count = 0
while count < 100:
	m = (l + r) / 2
	kk = 0
	for ai in a:
		kk += math.ceil(ai / m - 1)
	if kk <= k:
		r = m
	else:
		l = m
	count += 1
print(math.ceil(l))


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

def cnt(x):
	ret = 0
	for ai in a:
		ret += (ai + (x - 1)) // x - 1
	return ret
(ok, ng) = (a[-1], 0)
while ok - ng > 1:
	nw = (ok + ng) // 2
	if cnt(nw) <= k:
		ok = nw
	else:
		ng = nw
print(ok)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
ans = []
c = 2 ** 30
r = 2 ** 30
while r:
	r //= 2
	l = sum((-(-a // c) - 1 for a in A))
	if l > K:
		c += r
	else:
		ans.append(c)
		c -= r
print(ans and min(ans) or 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(leq, high) = (0, 10000000000.0)
while high - leq > 1:
	l = int((leq + high) / 2)
	cnt = 0
	for ai in a:
		cnt += int((ai - 1) / l)
	if cnt > k:
		leq = l
	else:
		high = l
print(high)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok = 10 ** 9 + 1

def check(x):
	cnt = 0
	for l in a:
		cnt += (l - 1) // x
	return cnt <= k
while abs(ok - ng) > 1:
	m = (ok + ng) // 2
	if check(m):
		ok = m
	else:
		ng = m
print(ok)


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

def check(l):
	count = 0
	for L in A:
		count += L // l
		if L % l != 0:
			count += 1
		count -= 1
	return count <= K
(bottom, top) = (0, max(A))
while top - bottom > 1:
	mid = (top + bottom) // 2
	if check(mid):
		top = mid
	else:
		bottom = mid
print(top)


import math
from heapq import heappop
import heapq
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = max(A) + 1
while l + 1 < r:
	m = (l + r) // 2
	tmp = 0
	for a in A:
		tmp += math.ceil(a / m) - 1
	if tmp <= K:
		r = m
	else:
		l = m
print(r)


(n, k, *A) = map(int, open(0).read().split())
l = 1
r = max(A)
while l != r:
	c = (l + r) // 2
	if k >= sum((-(-a // c) - 1 for a in A)):
		r = c
	else:
		l = c + 1
print(l)


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

def num_of_chopping(l, threshold):
	cnt = 0
	for i in l:
		cnt += -(-i // threshold) - 1
	return cnt
low = 0
high = max(A)
while low + 1 < high:
	mid = (low + high) // 2
	cnt = num_of_chopping(A, mid)
	if cnt <= K:
		high = mid
	else:
		low = mid
print(high)


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

def cnt(x):
	s = 0
	for i in ar:
		if i > x:
			s += (i - 1) // x
	return s
l = 0
r = 10 ** 9
while l < r - 1:
	m = (l + r) // 2
	c = cnt(m)
	if c > k:
		l = m
	else:
		r = m
print(r)


(n, k) = map(int, input().split())
(*a,) = map(int, input().split())
(l, r) = (0, 10 ** 9)
while r - l > 1:
	m = (l + r) // 2
	t = 0
	for x in a:
		if x <= m:
			continue
		t += (x + m - 1) // m - 1
	if t <= k:
		r = m
	else:
		l = m
print(r)


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

def is_ok(x):
	cnt = 0
	for a in A:
		cnt += -(-a // x) - 1
	return cnt <= K
(ng, ok) = (0, 10 ** 10)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if is_ok(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l + 1 < r:
	mid = (l + r) // 2
	if sum([(a - 1) // mid for a in A]) > k:
		l = mid
	else:
		r = mid
print(r)


(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
NG = 0
OK = max(A) + 1
while OK - NG > 1:
	mid = (OK + NG) // 2
	cur = 0
	for x in A:
		cur += (x - 1) // mid
	if cur > K:
		NG = mid
	else:
		OK = mid
print(OK)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ng = 0
ok = max(A)
while abs(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)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if k >= sum(a) - n:
	print(1)
else:
	(ok, ng) = (10 ** 9, 1)
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if sum(((x - 1) // mid for x in a)) <= k:
			ok = mid
		else:
			ng = mid
	print(ok)


from math import ceil
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = 10 ** 9
ans = 0
while l + 1 < r:
	m = (l + r) // 2
	c = 0
	for a in A:
		c += ceil(a / m) - 1
	if c <= k:
		ans = min(ans, m)
		r = m
	else:
		l = m
print(r)


(n, k) = 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))


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 1
r = 10 ** 9
import math
for i in range(100):
	temp = 0
	m = (r + l) / 2
	for j in a:
		temp += j // m
	if temp <= k:
		r = m
	else:
		l = m
print(math.ceil(m))


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

def f(t):
	if t != 0:
		c = 0
		for i in A:
			c += i // t if i != t else 0
		return c <= K
	else:
		return all((i <= t for i in A))
(left, right) = (-1, 10 ** 10)
while right - left > 1:
	m = (right + left) // 2
	if f(m):
		right = m
	else:
		left = m
print(right)


(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
(l, r) = (0, 10 ** 9)
while r - l > 1:
	x = (r + l) // 2
	c = 0
	for a in A:
		c += (a - 1) // x
	if c <= K:
		r = x
	else:
		l = x
print(r)


import math
(N, K) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 0
r = a[-1] + 1
while r - l > 1:
	mid = (r + l) // 2
	cnt = 0
	for i in a:
		cnt += (i - 1) // mid
	if cnt <= K:
		r = mid
	else:
		l = mid
print(r)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
left = 0
right = max(A) + 1
while left + 1 != right:
	mid = (left + right) // 2
	x = 0
	for a in A:
		x += math.ceil(a / mid) - 1
	if x <= K:
		right = mid
	else:
		left = mid
print(right)


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

def func(l, r):
	if l == r:
		return l
	mid = (l + r) // 2
	count = 0
	for i in A:
		count += (i - 0.1) // mid
	if count <= K:
		return func(l, mid)
	else:
		return func(mid + 1, r)
print(func(1, max(A)))


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

def solve(x):
	kk = k
	for i in a:
		kk -= (i + x - 1) // x - 1
	return kk >= 0
ok = 10 ** 9
ng = 0
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if solve(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, k) = list(map(int, input().split()))
alst = list(map(int, input().split()))
ok = max(alst)
ng = 0
while abs(ok - ng) > 1:
	cen = (ok + ng) // 2
	cnt = 0
	for a in alst:
		cnt += (a + cen - 1) // cen - 1
	if cnt <= k:
		ok = cen
	else:
		ng = cen
print(ok)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok = max(a)
while ng + 1 != ok:
	mid = (ng + ok) // 2
	ans = 0
	for aa in a:
		if aa % mid == 0:
			ans += aa // mid - 1
		else:
			ans += aa // mid
	if ans <= k:
		ok = mid
	else:
		ng = mid
print(ok)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = int(1000000000.0)

def f(x):
	count = 0
	for a in A:
		count += int((a - 1) / x)
	return count <= K
while r - l > 1:
	x = int((r + l) / 2)
	if f(x):
		r = x
	else:
		l = x
print(r)


(n, k) = map(int, input().split())
a = tuple(map(int, input().split()))
ok = 10 ** 9
ng = 0
while abs(ng - ok) > 1:
	mid = (ok + ng) // 2
	cnt = 0
	for i in a:
		cnt += (i + mid - 1) // mid - 1
	if cnt <= k:
		ok = mid
	else:
		ng = mid
print(ok)


(N, K) = 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)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
inf = 1
sup = max(a)
while inf < sup:
	x = (inf + sup) // 2
	cut = 0
	for a_i in a:
		cut += (a_i - 1) // x
	if cut <= k:
		sup = x
	else:
		inf = x + 1
print(sup)


(N, K) = map(int, input().split())
A = [int(a) for a in input().split()]

def chk(x):
	s = 0
	for a in A:
		s += (a - 1) // x
	return 1 if s <= K else 0
(l, r) = (0, 1 << 30)
while r - l > 1:
	m = (l + r) // 2
	if chk(m):
		r = m
	else:
		l = m
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9
while r - l > 1:
	m = (l + r) // 2
	b = list(map(lambda x: -(-x // m) - 1, a))
	ans = sum(b)
	if ans <= k:
		r = m
	else:
		l = m
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok = 10 ** 10
while ok - ng > 1:
	m = (ok + ng) // 2
	c = 0
	for i in a:
		c += i // m - (i % m == 0)
	if c <= k:
		ok = m
	else:
		ng = m
print(ok)


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

def check(x):
	count = 0
	for Ai in A:
		count += (Ai - 1) // x
	return count <= K
ok = 10 ** 9
ng = 0
while ok - ng > 1:
	mid = (ok + ng) // 2
	if check(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
input = sys.stdin.readline
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
OK = 10 ** 9
NG = 0
while OK - NG > 1:
	mid = (OK + NG) // 2
	ANS = 0
	for a in A:
		ANS += (a - 0.01) // mid
	if ANS <= K:
		OK = mid
	else:
		NG = mid
print(OK)


(n, k) = map(int, input().split())
list_A = list(map(int, input().split()))
(l, r) = (0, max(list_A))
while l + 1 < r:
	(m, cnt) = ((r + l) // 2, 0)
	for a in list_A:
		cnt += (a - 1) // m
	if cnt > k:
		l = m
	else:
		r = m
print(r)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
(x0, x1) = (0, 10 ** 9)
while x0 + 1 < x1:
	x = (x0 + x1) // 2
	s = sum(((a - 1) // x for a in A))
	if s > K:
		x0 = x
	else:
		x1 = x
print(x1)


(N, K) = map(int, input().split())
AList = list(map(int, input().split()))
l = 0
r = 10 ** 9
while r - l > 1:
	x = (l + r) // 2
	now = 0
	for a in AList:
		now += (a - 1) // x
	f = lambda now: True if now <= K else False
	if f(now):
		r = x
	else:
		l = x
print(r)


(N, K) = map(int, input().split())
A = sorted(list(map(int, input().split())))
(L, R) = (0, A[-1])
while R - L > 1:
	mid = L + (R - L) // 2
	if sum([(a - 1) // mid for a in A]) <= K:
		R = mid
	else:
		L = mid
print(R)


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

def f(x):
	r = 0
	for a in A:
		r += (a + x - 1) // x - 1
	return r
a = 0
b = 2 ** 32
while b > 0:
	if f(a + b) > K:
		a += b
	b //= 2
print(a + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok = 10 ** 9
while ng < ok - 1:
	mid = (ng + ok) // 2
	count = sum(((ai - 1) // mid for ai in a))
	if count <= k:
		ok = mid
	else:
		ng = mid
print(ok)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
(l, r) = (1, max(A))
while l < r:
	m = (l + r) // 2
	s = sum([a // m + (not a % m == 0) - 1 for a in A])
	if s <= K:
		r = m
	else:
		l = m + 1
print(r)


ceil = lambda a, b: (a + b - 1) // b
(N, K) = map(int, input().split())
A = tuple(map(int, input().split()))
(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)


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

def check(length):
	cuttings = sum(((l + length - 1) // length - 1 for l in a))
	return cuttings <= k
(l, r) = (0, max(a))
while l + 1 < r:
	mid = (l + r) // 2
	if check(mid):
		r = mid
	else:
		l = mid
print(r)


def is_ok(x):
	cnt = 0
	for a in A:
		cnt += -(-a // x) - 1
	if cnt <= k:
		return True
	return False

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
print(meguru_bisect(0, 10 ** 9 + 1))


(n, k) = map(int, input().split())
A = [int(x) for x in input().split()]
(s, l) = (0, max(A))
while l - s > 1:
	m = (s + l) // 2
	if sum([(a - 1) // m for a in A]) > k:
		s = m
	else:
		l = m
print(l)


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

def f(length, ls):
	cur = 0
	for a in ls:
		if a % length == 0:
			cur += a // length - 1
		else:
			cur += a // length
	if cur <= K:
		return True
	else:
		return False
(ok, ng) = (max(A), 0)
while abs(ok - ng) > 1:
	z = (ok + ng) // 2
	if f(z, A) == True:
		ok = z
	else:
		ng = z
print(ok)


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

def isOK(X):
	if X <= 0:
		return False
	return sum([-a // X * -1 - 1 for a in A]) <= K
ok = 10 ** 10
ng = -1
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if isOK(mid):
		ok = mid
	else:
		ng = mid
print(ok)


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

def check(n):
	cnt = 0
	for a in A:
		cnt += (a - 1) // n
	return cnt <= K
ng = 0
ok = 10 ** 9
while abs(ng - ok) > 1:
	i = (ng + ok) // 2
	if check(i):
		ok = i
	else:
		ng = i
print(ok)


from math import ceil
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]

def is_ok(x):
	c = 0
	for i in a:
		c += ceil(i / x) - 1
		if c > k:
			return False
	return True

def binary_search(m):
	left = 0
	right = m + 1
	while left <= right:
		center = (left + right) // 2
		if right - left == 1:
			return right
		elif is_ok(center):
			right = center
		else:
			left = center
if k == 0:
	print(max(a))
else:
	print(binary_search(max(a)))


(n, k) = 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)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
low = 0
high = max(a)
while low + 1 < high:
	mid = (low + high) // 2
	m = 0
	for x in a:
		m += (x - 1) // mid
	if m <= k:
		high = mid
	else:
		low = mid
print(high)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
import math
l = 0
r = max(a) + 1
for _ in range(100):
	m = (l + r) / 2
	kn = 0
	for i in a:
		kn += i // m
	if kn > k:
		l = m
	else:
		r = m
print(math.ceil(l))


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
OK = 10 ** 9
NG = 0
while OK - NG > 1:
	ans = 0
	mid = (OK + NG) // 2
	for a in A:
		ans += (a - 0.1) // mid
	if ans > K:
		NG = mid
	else:
		OK = mid
print(OK)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
ng = 0
ok = max(A)
while ok - ng > 1:
	cnt = 0
	l = (ok + ng) // 2
	for a in A:
		cnt += a // l + (a % l != 0) - 1
	if cnt <= K:
		ok = l
	else:
		ng = l
print(ok)


(N, K) = map(int, input().split())
A = [int(x) for x in input().split()]
l = 0
r = max(A) + 1
while l + 1 < r:
	m = (l + r) // 2
	count = 0
	for a in A:
		count += (a - 1) // m
	if count > K:
		l = m
	else:
		r = m
print(r)


(n, k) = map(int, input().split())
(*A,) = map(int, input().split())
(l, r) = (0, 10 ** 9)
while r - l > 1:
	c = (l + r) // 2
	if sum((-(-a // c) - 1 for a in A)) <= k:
		r = c
	else:
		l = c
print(r)


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

def func(b):
	c = k
	for i in a:
		c -= (i - 1) // b
		if c < 0:
			return False
	return True
l = 1
r = max(a)
while r > l:
	lr = (l + r) // 2
	if func(lr):
		r = lr
	else:
		l = lr + 1
print(r)


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

def check(x):
	k = 0
	for a in A:
		k += (a - 1) // x
	return k <= K
(ng, ok) = (0, 10 ** 9 + 1)
while ok - ng > 1:
	x = (ok + ng) // 2
	if check(x):
		ok = x
	else:
		ng = x
print(ok)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))

def cut(x):
	t = 0
	for i in a:
		if i <= x:
			continue
		t += ceil(i / x) - 1
	return t <= k
(l, r) = (0, 10 ** 9)
while l + 1 < r:
	x = l + (r - l) // 2
	if cut(x):
		r = x
	else:
		l = x
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
now = 0
scale = 2 ** 32
while scale:
	cnt = 0
	tmp = now + scale
	for x in a:
		cnt += (x - 1) // tmp
	if cnt > k:
		now = tmp
	scale //= 2
print(now + 1)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = max(A)
while not l + 1 == r:
	x = (r + l) // 2
	k = 0
	for a in A:
		k += math.ceil(a / x) - 1
	if k <= K:
		r = x
	else:
		l = x
print(r)