peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(int, input().split()))
lb, ub = 0, 10**9
while ub - lb > 1:
    m = (lb + ub) // 2
    cnt = 0
    for i in range(N):
        cnt += (A[i] + m - 1) // m - 1
    if cnt <= K:
        ub = m
    else:
        lb = m
print(ub)
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 = list(map(int,input().split()))
start = 0
end = 10**9
while end - start > 1:
   l = (start + end)/2
   l = int(l)
   count = 0
   for i in range(N):
      q = A[i]/l
      if q == int(q):
         q -= 1
      count += int(q)
   if count <= K:
      end = l
   else:
      start = l
print(end)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = max(a)

while r - l > 1:
    cnt = 0
    mid = (r + l) // 2
    for i in range(n):
        d = (a[i] - 1) // mid
        if d > 0: cnt += d
    if cnt <= k: r = mid
    else: l = mid 

print(r)
(N, K) = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]

L = 0
H = max(A)

def feasible(M): # M: maximum length    
    S = sum([(a - 1) // M for a in A])
    #print("S = {}, K = {}".format(S, K))
    return S <= K

# assert(not feasible(L))
assert(feasible(H))

while H - L > 1:
    #print(H, L)
    M = (H + L) // 2
    if feasible(M):
        H = M
    else:
        L = M

print(H)
def f(x):
    now = 0
    for i in range(n):
        now += (a[i]-1)//x

    return now <= k

n, k = map(int, input().split())
a = list(map(int, input().split()))
ng = 0
ok= int(1e9)
while ok - ng > 1:
    x = (ok + ng) // 2
    if f(x):
        ok = x
    else:
        ng = x

print(ok)
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)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def is_ok(L):
    count = 0
    for a in A:
        count += a // L
        if a % L == 0:
            count -= 1
    return count <= K

ng = 0
ok = max(A)
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)
from math import *
from collections import *
from random import *
from decimal import Decimal
from bisect import *
import sys
input=sys.stdin.readline
def lis():
    return list(map(int,input().split()))
def ma():
    return map(int,input().split())
def inp():
    return int(input())

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


def judge(length):
    cnt = 0
    for a in A:
        cnt += a // length
        if a % length == 0:  # ちょうど割り切れるときは切る回数が一回少なくて済む
            cnt -= 1
    return cnt <= k


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

print(ok)
import math


def f(A, m, K):
    p = sum([a // m for a in A])
    if p > K:
        return False
    else:
        return True


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


left = 0
right = 10 ** 9 + 1

while int(left) != int(right):
    m = (left + right) / 2

    if f(A, m, K):
        right = m
    else:
        left = m


print(math.ceil(m))
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[49]:


low = 0
high = max(A)
def ok(x):
    cnt = 0
    for a in A:
        cnt += (a//x)
        if a%x == 0:
            cnt -= 1
    return cnt <= K
 
while high-low > 1:
    mid = (high+low)//2
    if ok(mid):
        high = mid
    else:
        low = mid
print(high)


# In[ ]:
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)
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()))

def is_ok(X):
    # 全部をX以下にするために切る回数 <= K
    cnt = 0
    for i in range(N):
        cnt += (A[i]-1)//X
    return cnt <= K
 
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, 10**9))
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
l = 0
r = 10 ** 9 + 1
while l + 1 < r:
    p = (l + r) // 2
    n = 0
    ok = False
    for v in A:
        n += (v // p - 1)
        if not v % p == 0:
            n += 1
        if n > K:
            break
    else:
        ok = True
    if not ok:
        l = p
    else:
        r = p

print(r)
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

def ok(s):
    c=0
    for i in a:
        c+=-(-i//s)-1
    return c<=k


l=0
r=max(a)
while r>l+1:
    md=(r+l)//2
    if ok(md):
        r=md
    else:
        l=md
print(r)
def binarySearch(A, K):
    left = 1
    # right = n
    right = max(A)
    while left < right:
        mid = (left + right) // 2
        cost = sum(map(lambda x: (x-1)//mid, A))
        # print(left, right, mid)
        # print(K, cost)
        if K >= cost:
            right = mid
        else:
            left = mid + 1
    # return NOT_FOUND
    # return mid
    
    return left


N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
# print(sorted(A))
print(binarySearch(A, K))
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 = 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
  #print(tmp,cnt)
  scale //= 2
print(now+1)
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)
import math
n, k = map(int, input().split())
A = list(map(int, input().split()))

max_len = max(A)
def f(x):
    ans = 0
    for a in A:
        cut_num = math.ceil(a / x) - 1
        #print(a, cut_num, a / x)
        ans += cut_num
    if ans <= k:
        return True
    else:
        return False

left = 0.001
right = max_len
while right - left > 1:
    mid = (right + left) // 2
    if f(mid):
        right = mid
    else:
        left = mid
else:
    print(int(right))
N, K = map(int, input().split())
A = list(map(int, input().split()))

# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = max(A)
ng = 0
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2

    cnt = 0
    for a in A:
        l = (a + mid - 1) // mid
        cnt += l - 1
    if cnt <= K:
        ok = mid
    else:
        ng = mid

print(ok)
N, K = map(int, input().split())
a = list(map(int, input().split()))

max_a = 10**9
min_a = 0
while True:
    k = K
    res = (max_a+min_a)//2
    for i in range(N):
        if a[i] <= res:
            continue
        k -= (a[i]//res)
    if k >= 0:
        max_a = res
    else:
        min_a = res
    if max_a - min_a == 1:
        break
print(max_a)
N,K=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
N, K = 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)
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 = 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)
import math

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

max_l = max(A) + 1
min_l = 0
cur = (max_l + min_l) // 2


def check(l):
    count = 0
    for a in A:
        count += math.ceil(a / l) - 1

    return count <= K


while True:
    if check(cur):
        max_l = cur + 1
    else:
        min_l = cur

    if cur == (max_l + min_l) // 2:
        break

    cur = (max_l + min_l) // 2

print(cur)
# coding: utf-8

def solve(*args: str) -> str:
    n, k = 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))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
def is_good(mid, key):
    res = 0
    for a in A:
        res += (a + mid - 1) // mid
    return res - N <= key


def binary_search(bad, good, key):
    while good - bad > 1:
        mid = (bad + good) // 2
        if is_good(mid, key):
            good = mid
        else:
            bad = mid
    return good


N, K, *A = map(int, open(0).read().split())
print(binary_search(0, 1_000_000_000, K))
import math

def check(A, x, k):
    cut_count = 0
    for number in A:
        cut_count += (math.ceil(number / x)) -1
    return cut_count <= k

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

l = 0
r = 10 ** 9
 
while r - l > 1:
    x = (r + l) // 2
  
    if check(a, x, k):
        r = x
    else:
        l = x   
print(r)
from sys import stdin
from math import floor,ceil

N, K = map(int, input().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]

def is_max_len_less_than_input(x,K,A):
  count = 0
  if x==0:
    return False
  for ln in A:
    count += ceil(ln/x)-1
    if count > K:
      return False
  return True

def binary_search(begin,end,K,A):
  while abs(end-begin)>1:
    mid = (begin+end)//2
    if is_max_len_less_than_input(mid,K,A):
      end = mid
    else:
      begin = mid
  return end

print(binary_search(0,max(A),K,A))
N,K=map(int,input().split())
L=list(map(int,input().split()))
    
import math
MAX=10**9
MIN=0
for i in range(100):
    Mid=(MAX+MIN)/2
    cnt=0
    for j in range(N):
        cnt+=L[j]//Mid
    if cnt<=K:
        MAX=Mid
    else:
        MIN=Mid
    #print(cnt)
print(math.ceil(Mid))
from math import ceil


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

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)//m
        
    if count > k:
        l = m
    else:
        r = m
    
print(r)
import math

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

a.sort()
r = a[n-1]
l = 0


def calc(t,x):
    return math.ceil(t / x) - 1


while r - l > 1:
    mid = (r+l)//2
    count = 0
    for i in a:
        count += calc(i,mid)
    if count > k:
        l = mid
    else:
        r = mid

print(r)
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())
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)
def check(x,k,arr):
    now = 0
    for i in range(len(arr)):
        now+=int((arr[i]-1)/x)
    return now<=k

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

r, l = 1e9, 0
while (l+1<r):
    x = int((r+l)/2)
    if check(x,k,arr):
        r = x
    else:
        l = x
print(int(r))
def countcut(A, length):
    ret = 0
    for a in A:
        ret += -(-a//length) - 1
    return ret


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    lo = 1
    hi = int(1e9)
    while lo < hi:
        mid = (lo+hi) // 2
        if countcut(A, mid) <= K:
            hi = mid
        else:
            lo = mid + 1
    print(lo)


if __name__ == "__main__":
    main()
import sys
import numpy as np
import math
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))
n,k = Mi()
a = np.array(sys.stdin.readline().split(), np.int64)
mina = np.sum(a//(n+k))
maxa = np.max(a)
while maxa > mina+1:
  mid = (mina+maxa)//2
  div = np.sum(np.ceil(a/mid))-n
  if div > k:
    mina = mid
  else:
    maxa = mid
  
print(maxa)
n, k = map(int, input().split())
a = list(map(int, input().split()))

top = max(a)
bottom = 0

while (top - bottom) > 1:
    mid = (top + bottom) // 2
    div_n = lambda a: (a + mid - 1) // mid - 1
    cnt = sum(map(div_n, a))
    if cnt <= k:
        top = mid
    else:
        bottom = mid

print(top)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
l = 0 
h = a[0]
def pos(b):
  c = 0
  for i in range(n):
    if a[i] <= b:
      break
    c += math.ceil(a[i]/b)-1
    if c > k:
      return False
  return True
while l+1 < h:
  m = (l+h)//2
  if pos(m):
    h = m
  else:
    l = m
print(h)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = max(a)

while r - l > 1:
    cnt = 0
    mid = (r + l) // 2
    for i in range(n):
        d = (a[i] // mid) + (a[i] % mid != 0) - 1
        cnt += d
    if cnt <= k: r = mid
    else: l = mid 

print(r)
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)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l, r = 0, 10 ** 9
while r - l > 1:
    x = (l + r) // 2

    cnt = 0
    for i in range(n):
        if a[i] % x == 0:
            cnt += a[i] // x - 1
        else:
            cnt += a[i] // x

    if cnt <= k:
        r = x
    else:
        l = x

print(r)
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=map(int,input().split())
A=list(map(int,input().split()))
high=max(A)
low=0
while high-low>1:
    cnt=0
    now=(low+high)//2
    for a in A:
        cnt+=max((a-1)//now,0)
        if cnt>k:
            break
    if cnt>k:
        low=now
    else:
        high=now
    #print(cnt,low,high)
print(high)
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 = [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)
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)

if __name__=='__main__':
  n,k=map(int,input().split())
  a=list(map(int,input().split()))
  main()
import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))

n,k=I()
l=I()
lo=1;hi=max(l)
while lo<hi:
	md=(lo+hi)//2
	ct=0
	for i in range(n):
		ct+=l[i]//md-(l[i]%md==0)
	if ct<=k:
		hi=md
	else:
		lo=md+1
print(lo)
import math

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

lower = 0
upper = max(A)
mid = math.ceil((lower + upper) / 2)
while lower < upper:
    mid = math.ceil((lower + upper) / 2)
    if mid == upper:
        break
    # print(lower, mid, upper)
    cut = 0
    for a in A:
        cut += math.ceil(a / mid) - 1
    if cut <= K:
        upper = mid
    else:
        # K < cut
        lower = mid

print(mid)
from math import ceil

def check(A, K, L):
    i = 0
    for a in A:
        i += ceil(a/L)-1
        if i > K:
            return False
    return True

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
l = 0
r = A[0]
while l + 1 < r:
    m = (l+r)//2
    if check(A, K, m):
        r = m
    else:
        l = m
print(r)
#!/usr/bin/env python

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

def check(x):
    now = 0 
    for i in range(n):
        now += (a[i]-1)//x
    return now <= k

l = 0 
r = int(1e9)
while r-l > 1:
    mid = (l+r)//2

    if check(mid):
        r = mid 
    else:
        l = mid 

print(r)
n, k = map(int, input().split())
A = tuple(map(int, input().split()))
A = sorted(A, reverse=True)

l = 0
r = max(A)+1
def cut(l, k):
    # 長さlの丸太を最大とすることができるかどうかを返す
    for a in A:
        if a > l:
            k -= (-(-a//l) - 1)
    return k >= 0

while r-l > 1:
    mid = (r+l)//2
    if cut(mid, k):
        r = mid
    else:
        l = mid
print(r)
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
a = [int(item) for item in input().split()]
l = 0; r = 1000000001
while r - l > 1:
    mid = (l + r) // 2
    cnt = 0
    for item in a:
        cnt += (item - 1) // mid
    # Can be cut in k times
    if cnt <= k:
        r = mid
    else:
        l = mid

print(l + 1)
import math
n,k = map(int,input().split())
alist = list(map(int,input().split()))

max_length = max(alist)
cur_length = 0

while(max_length - cur_length > 1):
    next_length = (max_length+cur_length)//2

    test_k = 0
    for i in range(n):
        test_k += math.ceil(alist[i]/next_length)-1

    if test_k <= k:
        max_length = next_length
    else:
        cur_length = next_length
        

print(max_length)
import math

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

left = 0
right = max(An)

def check(x):
    chk = 0
    for i in range(n):
        chk += math.ceil(An[i]/x)-1
    return chk

while right-left!=1:
    x = (left+right)//2
    if check(x)<=k:
        right = x
    else:
        left = x

print(right)
import sys
import numpy as np
import math
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))
n,k = Mi()
a = np.array(sys.stdin.readline().split(), np.int64)
maxa = np.max(a)
mina = maxa//(k+1)
while maxa > mina+1:
  mid = (mina+maxa)//2
  div = np.sum(np.ceil(a/mid-1))
  if div > k:
    mina = mid
  else:
    maxa = mid
  
print(maxa)
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)
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)
n,k = 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)))
from math import ceil
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    left = 0
    right = 10 ** 9
    while (right - left) > 1:
        x = (left+right) // 2
        cnt = 0
        for a in A:
            cnt += (a-1) // x
        
        if cnt <= K:
            right = x
        else:
            left = x
    
    print(right)
    
if __name__ == '__main__':
    solve()
n, k = 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)
N,K = map(int, input().split())
A = list(map(int, input().split()))
    
l,r = 0, max(A)
while r-l>1:
  mid = (l+r)//2
  cnt = 0
  for i in range(N):
    if A[i]%mid!=0:
      cnt+= A[i]//mid
    else:
      cnt += A[i]//mid - 1
            
  if cnt <= K:
    r = mid
  else:
    l = mid
print(r)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def test(m):
    if m <= 0:
        return False
    needed = 0
    for a in A:
        needed += (a-1)//m
        if needed > K:
            return False
    return True

lb = 1
ub = max(A)

while True:
    m = (lb + ub) // 2
    if test(m):
        if test(m-1):
            ub = m - 1
        else:
            print(m)
            exit()
    else:
        lb = m + 1
N, K = map(int, input().split())
A = list(map(int, input().split()))

mi = 0
ma = 10**9
while(ma - mi != 1):
    c = 0
    mid = (ma + mi) // 2
    for i in range(N):
        c += A[i] // mid - (A[i] % mid == 0)
    if c > K:
        mi = mid
    else:
        ma = mid
print(ma)
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()))

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)