peterverebics/CodeNet_Python_118 huggingface dataset:
import math

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

def solve(x):    #Trueで切り切れる
    cnt = 0
    for a in A:
        cnt += math.ceil(a / x) - 1
    return cnt <= K

left = 0
right = 10 ** 9 + 1

for _ in range(100):
    mid = (left + right) / 2
    if solve(mid):
        right = mid
    else:
        left = mid

print(math.ceil(right))
import math

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

def seikai(x):
    count = 0
    for i in range(n):
        count += math.ceil(a[i] / x) - 1

    if(count <= k):
        return 1
    else:
        return 0

l = 0
r = 10 ** 9
while(r - l > 1):
    temp = (r + l) // 2
    if(seikai(temp) == 1):
        r = temp
    else:
        l = temp

print(r)
import math

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

def cond(x):
    s = 0
    for i in range(n):
        s += math.ceil(a[i]/x)-1
    return s <= k

l, r = 0, 10**9
while l+1 < r:
    mid = (l+r)//2
    if cond(mid):
        r = mid
    else:
        l = mid
print(r)
N, K = map(int, input().split())
A = list(map(int, input().split()))

l = 0
r = max(A)
for _ in range(30):
    mid = (r + l + 1) // 2
    count = 0
    for log in A:
        if log > mid:
            count += (log + mid - 1) // mid - 1
    if count <= K:
        r = mid
    else:
        l = mid

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

def check(x):
    cnt = 0
    for ai in a:
        cnt += (ai-1)//x
        if cnt > k:
            return False
    return True

left = 0
right = 10**9+1
while right-left>1:
    mid = (right+left)//2
    if check(mid):
        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)
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)))
from math import ceil
from fractions import Fraction

n, k, *aa = map(Fraction, open(0).read().split())

imp_length = 0
psbl_length = max(aa)

while psbl_length - imp_length > 1:
    mid = (psbl_length + imp_length) // 2
    cost = sum(ceil(a / mid) - 1 for a in aa)
    if cost <= k:
        psbl_length = mid
    else:
        imp_length = mid

print(psbl_length)
import math

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

floor = 0
ceil = max(a)


def cut(long, logs):
    cnt = 0
    for i in logs:
        cnt += math.ceil(i / long) - 1
    return cnt


while ceil - floor > 1:
    L = (ceil + floor)//2
    num = cut(L, a)
    if num <= k:
        ceil = L
    else:
        floor = L

print(ceil)
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, 10**9 # (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)
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)
N,K=map(int,input().split())
A=list(map(int,input().split()))

MIN=0
MAX=10**9
while MAX-MIN>1:
    mid=(MAX+MIN)//2
    tmp=0
    for i in range(N):
        tmp+=(A[i]-1)//mid
    if tmp>K:
        MIN=mid
    else:
        MAX=mid
print(MAX)
def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    l, r = 0, max(A)
    while r - l > 1:
        c = (l + r) // 2
        if sum((a - 1) // c if a > c else 0 for a in A) <= k:
            r = c
        else:
            l = c
    print(r)

if __name__ == '__main__':
    main()
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)
import math
N, K = map(int,input().rstrip().split())
A = list(map(int,input().rstrip().split()))
maxX = max(A)
minX = 0
X = (maxX + minX)//2

while X!=minX:
    num = sum([math.ceil(A[i]/X)-1 for i in range(N)])
    if num<=K:
        maxX = X
    else:
        minX = X
    X = (maxX + minX)//2
num = sum([math.ceil(A[i]/maxX)-1 for i in range(N)])
if num<=K:
    print(maxX)
else:
    print(minX)
from math import *

def trycut(val):
	if val == 0 : return float('inf')
	ret = 0
	for i in range(n):
		ret += (a[i]+val-1)//val -1
	return ret 

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

low = 0
high = max(a)
ans  =-1

while low <= high:
	mid = (low + high)//2
	cut = trycut(mid)
	if cut <= k:
		high = mid-1
		ans = mid
	else:
		low =  mid+1
print(ans)
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)
from math import ceil
N, K = list(map(int, input().split()))

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

def possible(A, K, target):
    count = 0

    for a in A:
        count += ceil(a / target) - 1
    return count <= K

left = 1
right = max(A)

while left < right:
    mid = (left + right) // 2
    if possible(A, K, mid):
        right = mid
    else:
        left = mid + 1

print(right)
import math
def judge(x):
    cnt=0
    for l in a:
        c=l//x
        if l%x!=0:
            c+=1
        cnt+=c-1 
    return cnt<=k

n,k=map(int,input().split())
a=list(map(int,input().split()))
left=0
right=max(a)
mid=(left+right)//2
while right-left>1:# 最後は整数なので実数で扱わなくていい
    if judge(mid):
        right=mid
        mid=(left+right)//2
    else:
        left=mid
        mid=(left+right)//2
print(right)
n,k=map(int,input().split())
a=list(map(int,input().split()))
import math
ng=0
ok=max(a)
center=(ok+ng)//2
while ng+1!=ok:
  counter=0
  for i in range(len(a)):
    counter+=math.ceil(a[i]/center)-1
  if counter>k:
    ng=center
    center=(ok+ng)//2
  else:
    ok=center
    center=(ok+ng)//2
print(ok)
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = int(1e9)

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)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K = mapint()
As = list(mapint())
maxa = max(As)

l, r = 0, maxa+1
while r-l>1:
    half = (l+r)//2
    cnt = 0
    for a in As:
        cnt += -(-a//half)-1
    if cnt>K:
        l = half
    else:
        r = half

print(r)
from heapq import heapify, heappop, heappush
from math import ceil
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
A = inpl()
total = sum(A)
H = []
remnant = K
for a in A:
    n = (K*a)//total
    remnant -= n
    H.append((-a/(n+1), n, a))
heapify(H)
for k in range(remnant):
    L, n, a = heappop(H)
    heappush(H, (-a/(n+2), n+1, a))
ans = int(ceil(-H[0][0]))
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
ok = max(a)
ng = 1

from math import ceil

def f(length):
  rtn = 0
  for i in range(n):
    rtn += ceil(a[i]/length) - 1
  return rtn

if f(1) == 0:
  print(1)
else:
  while ok - ng > 1:
    mid = (ok + ng)//2
    if f(mid) <= k:
      ok = mid
    else:
      ng = mid

  if f(ng) > k:
    print(ok)
  else:
    print(ng)
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)
import sys
from fractions import Fraction
import math
import heapq
input = sys.stdin.readline

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

s = sum(a)

w = [(k * a[i]) // s for i in range(n)]
b = [Fraction((w[i] + 1), a[i]) for i in range(n)]

r = k - sum(w)

heapq.heapify(b)
#print(b)

for i in range(r):
    x = heapq.heappop(b)
    heapq.heappush(b, Fraction(x.numerator+1, x.denominator))

y = heapq.heappop(b)

print(math.ceil(Fraction(y.denominator, y.numerator)))
n,k=map(int,input().split())
A=[int(i) for i in input().split()]


def f(i):
    if i<=0: return False
    if i>= 10**9: return True
    x = sum([(a-1)//i for a in A])
    if x<=k:
        return True
    else:
        return False
l=-1
r=10**9
while r-l>1:
    m = (l+r)//2
    if f(m):
        r=m
    else:
        l=m
    #print(l,m,r)
print(r)
n, k = map(int, input().split())
a = [int(x) for x in input().split()]

lo = 1
hi = max(a)


def ceildiv(a, b):
    return (a + b - 1) // b

def ok(x):
    cuts = 0
    for log in a:
        cuts += ceildiv(log, x) - 1

    if cuts <= k:
        return True

    return False

while lo < hi:
    mid = (lo + hi) // 2

    if ok(mid):
        hi = mid
    else:
        lo = mid + 1

print(lo)
n,k=map(int,input().split())
A=list(map(int,input().split()))
ng=0
ok=10**10
while ok-ng>1:
  mid=(ok+ng)//2
  c=0
  for i in range(n):
    c=c+(A[i]+mid-1)//mid
  if c>k+n:
    ng=mid
  else:
    ok=mid
print(ok)
import heapq
n , k = map(int,input().split())
a = list(map(int,input().split()))
lef = 0
rig = max(a)
while rig - lef != 1:
    now = -(-(lef+rig)//2)
    cou = 0
    for i in range(n):
        cou += -(-a[i]//now) - 1
    if cou <= k:
        rig = now
    elif cou > k:
        lef = now
print(rig)
#!/usr/bin/env python3

import os
import sys
import numpy as np

def ncut(l, x):
  return np.sum(np.ceil(l / x) - 1)

def solve(N, K, AS):
  ng, ok = -1, np.amax(AS)
  while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if ncut(AS, mid) <= K:
      ok = mid
    else:
      ng = mid

  return ok.item()


def main():
  d = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
  N, K = d[:2]
  AS = d[2:]

  print('{}'.format(solve(N, K, AS)))

if __name__ == '__main__':
  main()
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 = 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))
#Binary Search:
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: # feasible
    t = m
  else: # infeasible
    s = m
print(t)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def is_cuttable(N):
    n = 0
    for a in A:
        i = a // N
        if a % N == 0:
            i -= 1
        n += int(i)
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)
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)))
from math import ceil

def isOK(length):
  ans = 0
  for a in A:
    ans += ceil(a / length) - 1
  return ans <= k

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

start, end = 0, 10**9 + 1
while True:
  mid = (start + end) // 2
  if mid == 1:
    print(mid)
    exit()
  prev = mid - 1
  if isOK(mid):
    if isOK(prev):
      end = mid
    else:
      print(mid)
      exit()
  else:
    start = mid
def main():
    N, K = map( int, input().split())
    A = list( map( int, input().split()))
    cnt = 0
    l = 0
    r = 10**9+1
        
    ans = 0
    while r-l > 1:
        m = (l+r)//2
        k = 0
        # print(l,r)
        for a in A:
            k += ((a+m-1)//m)-1
        if k <= K:
            r = m
        else:
            l = m
    print(r)
if __name__ == '__main__':
    main()
from math import ceil
N,K=map(int, input().split())

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

left=1
right=10**9+1
ans=float("INF")
while True:
    mid=(left+right)//2
    now=0
    for i in range(N):
        now+=ceil(A[i]/mid)-1

    if now>K:
        if left==mid:
            break
        left=mid
    else:
        ans=min(ans, mid)
        if right==mid:
            break
        right=mid

print(ans)
import sys
import math
input = sys.stdin.readline

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

def check(x):
    res = 0
    for i in a:
        res += math.floor(i / x)
    return res

l = 0
r = 10 ** 9 + 1
for _ in range(100):
    x = (l + r) / 2
    if check(x) > k:
        l = x
    else:
        r = x
print(math.ceil(l))
n, k = map(int, input().split())
a = list(map(int, input().split()))

lb, ub = 0, max(a)
while ub - lb > 1:
    mid = (ub + lb) // 2

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

    if cnt <= k:
        ub = mid
    else:
        lb = mid

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

# 合計N+Kこになる


l = 0
r = 2 * 10 ** 9 + 10 ** 6
while r - l > 1:
    m = (r + l) // 2
    cnt = 0
    for a in A:
        cnt += (a + m - 1) // m
    if cnt <= N + K:
        r = m
    else:
        l = m

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((a-1)//m for a in A): ng = m
    else: ok = m
print(ok)
n, k = map(int, input().split())
a = [i-1 for i in map(int, input().split())]
left, right = 1, 10**9
while left < right:
    middle = (left + right)//2
    count = sum(i//middle for i in a)
    if count <= k:
        right = middle
    else:
        left = middle + 1
print(left)
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()))
    ok = max(A)
    ng = 0

    while abs(ok - ng) > 1:
        mid = abs(ok + ng) // 2
        count = 0
        for i in range(N):
            count += math.ceil(A[i] / mid)-1
        if count <=K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()
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)
from sys import stdin
rs = stdin.readline
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))
from functools import reduce

def main():
    N, K = ril()
    A = ril()
    l = 1
    r = 1000000000
    while l < r:
        m = (l + r) // 2
        f = lambda i, j : i + (j - 1) // m
        k = reduce(f, A, 0)
        if k <= K:
            r = m
        else:
            l = m + 1
    print(r)

if __name__ == '__main__':
    main()
n,k=list(map(int,input().split()))
alst=list(map(lambda x:int(x)*100,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+1

if ok%100==0:
    print(ok//100)
else:
    print(ok//100+1)
import math as m

def isltK(K,X):
    ccut=0
    for Ai in As:
        ccut += m.ceil(Ai/X)-1
    if ccut <=K:
        return True
    else:
        return False


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

l=1
h=max(As)
while l < h:
    mid = (l+h)//2
    if isltK(K,mid):
        h=mid
    else:
        l=mid+1
print(l)
n, k = map(int, input().split())
a = list(map(int, input().split()))
low = 0
top = max(a) + 1

while top - low > 1:
  mid = (top + low) // 2
  cnt = 0
  for i in range(n):
    cnt += (a[i] + 1) // mid
  if cnt <= k:
    top = mid
  else:
    low = mid
print(low)
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    from heapq import heappop, heappush, heapreplace
    a = [-x for x in a]
    a.sort()
    for i in range(k):
        x = a[0]
        if abs(x) < 1:
            break
        heapreplace(a, x//3)
        heappush(a, x-x//3)
    ans = abs(a[0])
    print(ans)
    


if __name__ == '__main__':
    main()
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

def f(X):
    cnt = 0
    for a in A:
        cnt += int(a/X)
    return max(1, cnt)

l = 1
r = max(A)
while r-l > 0.1:
    m = (r+l)/2
    if f(m) <= K:
        r = m
    else:
        l = m

if K == 0:
    print(max(A))
elif f(r) >= K and int(r) < r:
    print(int(r)+1)
elif int(l) < l:
    print(int(l)+1)
else:
    print(int(l))
import math

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

if K == 0:
  print(int(max(A)))
  exit()

if N == 1:
  print(math.ceil(A[0]/K))
  exit()


min_A = 0
max_A = max(A)

while( max_A - min_A > 1):
  now = (min_A + max_A) / 2
  temp = 0
  for i in A:
    temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now
print(math.ceil((min_A + max_A)/2))
import math

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

m = 0
M = max(A)

while(M-m>0.0001):
    mm = 0

    mid = (M+m)/2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid+1
    else:
        M = mid

print(math.ceil(mid))
import math
n,k=map(int,input().split())
log=list(map(int,input().split()))
a=1
b=max(log)
c=(a+b)//2
while True:
  div=0
  for i in range(n):
    div+=math.ceil(log[i]/c)-1
  if div<=k:
    b=c
    c=(a+b)//2
  else:
    a=c
    c=(a+b)//2
    
  if c==a or c==b:
    break
print(b)
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
from math import ceil
def main(N, K, A):
    def cut_times(longest):
        return sum(a // longest for a in A)
    under = 0
    r = 10**9
    for i in range(100):
        m = (under + r) / 2
        if cut_times(m) > K: under = m
        else: r = m
    print(ceil(r - 10**-5))

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)
import heapq
import math

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

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

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

ans = heapq.heappop(A)[0]

ans = math.ceil(-ans)

print(ans)
import math

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

if K == 0:
  print(int(max(A)))
  exit()

if N == 1:
  print(math.ceil(A[0]/K))
  exit()


min_A = 0
max_A = max(A)

while( max_A - min_A > 1):
  now = (min_A + max_A) / 2
  temp = 0
  for i in A:
    temp += int(i / now)
  if temp > K:
    min_A = now
  else:
    max_A = now
  
print(int(min_A) + 1)
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(l,r)

print(r)
import numpy as np

N, K = [int(x) for x in input().split()]
A = np.array([int(x) for x in input().split()])

L = np.max(A)

ans = L
low = 1
high = L
while 1:
    print(str(low) + ' ' + str(high))
    if low == high:
        ans = low
        break
    mid = (low + high) // 2
    if np.sum(A // mid) <= K:
        high = mid
    else:
        low = mid + 1

print(ans)
import numpy as np

N,K = [int(x) for x in input().split()]
Ls  = [int(x) for x in input().split()]

Ls = np.array(Ls)
cut = np.array([1]*N)
ans = Ls / cut

for k in range(K):
    idx = np.argmax(ans)
    cut[idx] += 1
    ans = Ls / cut
print(int(np.round(max(ans))))
n, k = map(int, input().split())
a = list(map(int, input().split()))
low = 0
top = max(a) + 1

while top - low > 1:
  mid = (top + low) // 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:
    top = mid
  else:
    low = mid
print(low)
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

left = 0 # できない
right = a[0] # できる
while left+1 < right:
    mid = (left+right) // 2
    cnt = 0
    for i in range(n):
        cnt += a[i] // mid
        if cnt > k: break
    if cnt > k:
        left = mid
    else:
        right = mid
print(right)
from math import ceil


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    lower = 1
    upper = 10 ** 9 + 7
    while upper - lower >= 0.5:
        target = (lower + upper) / 2
        now = 0
        for i in range(n):
            now += ceil(a[i] / target) - 1
        if now > k:
            lower = target
        else:
            upper = target
    print(ceil(lower) if k > 0 else a[-1])


if __name__ == '__main__':
    main()
import numpy as np
def solve(n, k, a):
    lb = 0
    ub = np.max(a)
    while ub - lb > 1:
        cur = (lb + ub) / 2
        cnt = np.sum(np.ceil(a/cur)) - n
        if cnt > k:
            lb = cur
        else:
            ub = cur
    return int(np.ceil((lb+ub) / 2))

n, k = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, k, a))
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
U = max(A)
L = 1


def can(x, K):
    ct = 0
    for i in range(N):
        ct += (A[i]-1)//x
    if ct <= K:
        return True
    else:
        return False


while U-L > 1:
    x = (U+L)//2
    if can(x, K):
        U = x
    else:
        L = x

print(U)
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmax=max(a)
tmin=0
t=(tmax+tmin)/2
import math
ans=0
if k==0:
  print(tmax)
else:
  while True:
    s=0
    for i in range(n):
      s=s+math.ceil(a[i]/t)-1
    if k>=s:
      ans=t
      tmax=t
      t=(tmin+t)/2
    else:
      tmin=t
      t=(t+tmax)/2
    if tmax-tmin<0.01:
      break
  print(math.ceil(ans))
import math

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

m = 0
M = max(A)

while(M-m>0.5):
    mm = 0

    mid = (M+m)/2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid
    else:
        M = mid

print(math.ceil(mid))
n, k = map(int, input().split())
a = list(map(int, input().split()))

def check(x):
  c = 0
  for i in range(n):
    c += a[i]//x
  if c <= k:
    return True
  else:
    return False

mx = max(a)
mn = 0
ans = [mx]
while mn < mx:
  m = (mx+mn)//2
  if m == 0:
    break
  if check(m):
    mx = m - 1
    ans.append(m)
  else:
    mn = m + 1
print (min(ans))
import math
N, K = map(int,input().split())
A = [int(i) for i in input().split()]

low = 1
high = 10 ** 9
if K == 0:
    print(max(A))
else:
    while high - low > 1:
        mid = (low + high) / 2
        times = 0
        for a in A:
            times += math.ceil(a / mid) - 1
        if K >= times:
            high = mid
        else:
            low = mid
        #print(mid)

    print(math.ceil(mid))