peterverebics/CodeNet_Python_118 huggingface dataset:
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmax=max(a)
tmin=0
t=(tmax+tmin)/2
import math
ans=tmax
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=min(t,ans)
      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
def solve(n, k, a):
    lb = 0
    ub = max(a)
    while abs(ub - lb) > 1:
        cur = (lb + ub) / 2
        cnt = sum(math.ceil(x/cur-1) for x in a)
        if cnt > k:
            lb = cur
        else:
            ub = cur
    return int(math.ceil((lb+ub) / 2))

n, k = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, k, a))
#!/usr/bin/env python3
from math import ceil

EPS = 1e-8
n, k = map(int, input().split())
a = list(map(int, input().split()))


def f(p):
    c = 0
    for x in a:
        c += (x + p - 1) // p - 1
    return c


ok, ng = 0, max(a)
while abs(ok - ng) > 1:
    m = (ok + ng) / 2
    if f(m) > k:
        ok = m
    else:
        ng = m
print(ceil(ok) + 1)
# coding: utf-8


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = tuple(map(int, args[1].split()))

    l, r = 0, max(A)
    while l+1 < r:
        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())))
N, K = map(int, input().split())
A = list(map(int, input().split()))

def isOk(x):
    cnt = 0
    for a in A:
        cnt += a // 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

if ok > 1 and isOk(ok - 1):
    ok -= 1

print(ok)
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
l=1
r=a[-1]
while r-l>1:
  cnt=0
  m=(l+r)//2
  #print("l,m,r",l,m,r)
  for i in a:
    cnt+=(i-1)//m
  if cnt<=k:
    r=m
  else:
    l=m
print(r)
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 0
R = max(A)
while int(R)-int(L) > 1:
    X = (L+R)/2
    m = 0
    for i in range(N):
        c = A[i]/X
        if c == int(c):
            m += int(c) - 1
        else:
            m += int(c)
    if m <= K:
        R = X
    else:
        L = X
print(int(R))
import math

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

def is_ok(mid):
    cnt = 0
    for i in range(N):  cnt += math.floor(A[i] / mid)
    return cnt <= K

def binary_search(left, right):
    while (abs(right - left) > 1):
        mid = (left + right) // 2
        if is_ok(mid):  right = mid
        else:  left = mid
    return right

if K == 0:  print(max(A))
else:
    left = max(A) + 1
    right = 0
    ret = binary_search(right, left)
    print(ret)
# でつ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**-10))

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)
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//2)
    ans = abs(a[0])
    print(ans)
    


if __name__ == '__main__':
    main()
n,k,*a = map(int,open(0).read().split())
def func(b):
  c = k
  for i in a:
    if b == 0:
      c -= i+1
    else:
      c -= i//b
    if c < 0:
      return False
  return True
l = 0
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()))
l,r=max(a),1
while l-r>1:
    t=(l+r)//2
    c=0
    for i in a:
        c+=i//t
    if c>k:
        r=t
    else:
        l=t
print(l)
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmax=max(a)
tmin=0
import math
ans=tmax
if k==0:
  print(tmax)
else:
  while True:
    t=(tmax+tmin)/2
    if tmax-tmin<0.01:
      break
    s=0
    for i in range(n):
      s=s+math.ceil(a[i]/t)-1
    if k>=s:
      ans=min(math.ceil(t),math.ceil(ans))
      tmax=t
    else:
      tmin=t
  print(ans)
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 > 1:
    m = (r+l)//2
    if f(m) <= K:
        r = m
    else:
        l = m

if K == 0:
    print(max(A))
elif f(r) <= K:
    print(r)
else:
    print(l)
N, K = map(int, input().split())
a = list(map(int, input().split()))

max_a = 10**9
min_a = 0

while max_a-min_a != 1:
    count = K
    mean_a = (max_a+min_a)//2

    for i in range(N):
        count -= a[i]//mean_a

    if count >= 0:
        max_a = mean_a
    else:
        min_a = mean_a

print(max_a)
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( int(max_A) - int(min_A) != 0):
  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)
def main():
    n,k=map(int,input().split())
    lst=sorted(list(map(int,input().split())))
    
    left=0
    right=lst[-1]
    while right-left>1:
        mid=(right+left)//2
        sm=0
        for x in lst:
            sm+=x//mid
        
        if sm<=k:
            right=mid
        else : left=mid
    print(right)

main()
import math
N, K = map(int,input().split())
logs = list(map(int,input().split()))
a = 0
b = max(logs)
b_memo = set()
count=0
flg =0
while b-a < 1:
    c = (a+b)//2
    times = []
    for i in logs:
        times.append(math.floor(i/c))
    if sum(times) > K:
        a = c
    else:
        b = c

print(math.ceil(a))
import math
n,k=map(int,input().split())
log=list(map(int,input().split()))
a=1
b=max(log)
if b==1:
  print(1)
  exit()
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)
import math
def solve(K, N, A, length):
    s = 0
    for i in range(N):
        if A[i] > length:
            s += int(A[i] / length)
    return K >= s


N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
if K == 0:
    print(A[-1])
    exit()
ok = 10**9
ng = 1
while abs(ok - ng) > 1:
    mid = (ok + ng) / 2
    if solve(K, N, A, mid):
        ok = mid
    else:
        ng = mid

print(math.ceil(mid))
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:
        cnt += a//mid
    if cnt <=k:
        r = mid
    else:
        l = mid+1
print(l)
#E - Logs
import math
# 入力
N,K = map(int,input().split())
A   = list(map(int,input().split()))
Amax = int(max(A))
high = Amax
Cancut = Amax
low  = 0
while ( low <= high ) :
    Cut = 0
    X = (high + low) / 2
    for i in range(N):
        Cut = Cut + math.ceil(A[i]/X) - 1
    if Cut <= K:
        high = X - 0.1
        Cancut = X
    else:
        low  = X + 0.1
# 出力
print(math.ceil(Cancut))
import math

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

maruta = list(map(int, input().split()))
maruta = sorted(maruta, reverse=True)
 
for i in range(k):
  maruta[0] /= 2
  maruta.append(maruta[0]/2)
  maruta = sorted(maruta, reverse=True)
  
print(math.ceil(maruta[0]))
import heapq


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, K = read_ints()
    A = [(-a, a, 1) for a in read_ints()]
    heapq.heapify(A)
    for _ in range(K):
        _, a, k = heapq.heappop(A)
        heapq.heappush(A, (-a/(k+1), a, k+1))
    max_log, _, _ = heapq.heappop(A)
    max_log = -max_log
    return round(max_log)


if __name__ == '__main__':
    print(solve())
n, k = map(int, input().split())
a = list(map(int, input().split()))

left = 0
right = max(a)


for _ in range(100):
    mid = left + (right - left) / 2
    count = 0
    for i in range(n):
        count += (a[i]-10**(-10))//mid

    if count > k:
        left = mid
    else:
        right = mid

print(int(left+1))
#二分探査かぁ…
from math import *
import fractions
import collections
import itertools
import pprint
from collections import deque
from heapq import *
N,K=map(int,input().split())
A=list(map(int,input().split()))
maxnum=10**9
minnum=1
while maxnum-minnum>1:
    cnt=0
    piv=(maxnum+minnum)//2
    for i in range(N):
        cnt=cnt+ceil(A[i]/piv)-1
    #print(cnt,piv)
    if cnt>K:
        minnum=piv
    else:
        maxnum=piv
    #print(maxnum,minnum)
    #input()
print(maxnum)
from math import ceil
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
l = -1
r = 10**9
while l+1 < r:
    m = (l+r)//2
    if m == 0:
        r = 0
        break
    cnt = 0
    for i in range(n):
        cnt += ceil(a[i]/m)-1
    if cnt <= k: r = m
    else: l = m
print(r)
N,K = map(int,input().split())
arr = list(map(int,input().split()))
denominator = sum(arr)

import copy
value = copy.deepcopy(arr)
piece = [1 for i in range(N)]
left = K+N-sum(piece)
for i in range(left):
    j = value.index(max(value))
    piece[j] += 1
    value[j] = arr[j]/piece[j]

import math
print(round(round(max(value)*10)/10))
#E - Logs
import math
# 入力
N,K = map(int,input().split())
A   = list(map(int,input().split()))
Amax = int(max(A))
high = Amax
Cancut = Amax
low  = 0
while ( (high - low) > 0.001 ) :
    Cut = 0
    X = (high + low) / 2.0
    for i in range(N):
        Cut = Cut + math.ceil(A[i]/X) - 1
    if Cut <= K:
        high = X
        Cancut = X
    else:
        low  = X
# 出力
Cancut = math.floor( 1000 * Cancut) / 1000.0
print(math.ceil(Cancut))
from math import floor, ceil


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    lower = 1
    upper = a[-1]
    while upper - lower >= 0.25:
        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(upper) if k > 0 else a[-1])


if __name__ == '__main__':
    main()
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
  print(max(A))
  exit()
def f(x):
  cnt=0
  for i in A:
    cnt+=i//x
  if cnt<=K:
    return True
  else:
    return False
ok=1
ng=1000000000
for i in range(50):
  mid=(ok+ng)//2
  if f(mid):
    ng=mid
  else:
    ok=mid
print(ng)
from sys import stdin
input = stdin.buffer.readline
n, k = map(int, input().split())
*a, = map(int, input().split())
def f(mx):
    cnt = 0
    for i in a:
        cnt += (i + mx - 1) // mx - 1
    return cnt
l, r = 1, max(a) + 1
while r - l > 1:
    m = (l + r) >> 1
    if f(m) > k:
        l = m
    else:
        r = m
print(r)
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
from math import ceil
def main(N, K, A):
    lo = -1
    hi = 10**9
    for i in range(100):
        m = (lo + hi) / 2
        if sum(ceil(a / m) - 1 for a in A) <= K: hi = m
        else: lo = m
    print(ceil(hi))

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)
#!/usr/bin/env python3
from math import ceil

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


def f(p):
    c = 0
    for x in a:
        c += x // p
    return c


ok, ng = 0, max(a) + 1
while abs(ok - ng) > 1e-5:
    m = (ok + ng) / 2
    if f(m) > k:
        ok = m
    else:
        ng = m
print(ceil(ok))
from math import ceil


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

    def check(Min):
        kill = 0
        for a in A:
            kill += (ceil(a/Min)-1)
        return kill <= K

    l = 1
    r = 1000000000

    while r-l > 1:
        mid = (l+r)//2
        if check(mid):
            r = mid
        else:
            l = mid
    print(r)


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

    left = 1
    right = max(A)

    while abs(right-left)>1:
        cent = (right+left)//2
        
        ct = 0
        for a in A:
            ct+=a//cent
        
        if ct <= k:
            right=cent
        else:
            left=cent
    
    print(right)
main()
n,k=map(int,input().split())
A=list(map(int,input().split()))
high=max(A)
low=1
while high-low>1:
    cnt=0
    now=(low+high)//2
    for a in A:
        cnt+=a//now
        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=sorted(list(map(int,input().split())))
if K==0:print(max(A));exit()

left,right=0,10**9+1
while right>left+1:
    cnt=K
    mid=(left+right)//2
    for i in range(N):
        cnt -=A[i]//mid
    if cnt>=0:right=mid
    elif cnt<0:left=mid
print(right)
import math
import heapq
n,k = map(int,input().split())
s = list(map(int,input().split()))
a = list(map(lambda x: x*(-1), s))
heapq.heapify(a)
for i in range(k):
    m=heapq.heappop(a)
    heapq.heappush(a, m/2)
ans=heapq.heappop(a)*(-1)
print(math.ceil(ans))
N, K = map(int, input().split())
A = list(map(int, input().split()))

if N > K:
    for _ in range(K):
        cut = max(A)
        A.remove(cut)
        A.append(cut / 2)
        A.append(cut / 2)
    print(int(max(A)))
n,k = map(int, input().split())

maruta = []
maruta = list(map(int, input().split()))
maruta = sorted(maruta, reverse=True)

for i in range(k):
  maruta[0] /= 2
  maruta = sorted(maruta, reverse=True)
  
print(maruta[0])
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 1
high = 10**9

while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    #print(mid)
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
    #print(tmp,mid)
    
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)
#E - Logs
import math
# 入力
N,K = map(int,input().split())
A   = list(map(int,input().split()))
Amax = max(A)
high = Amax
Cancut = Amax
low  = 0
while ( (high - low) > 0.1 ) :
    Cut = 0
    X = (high + low) / 2.0
    for i in range(N):
        Cut = Cut + math.ceil(A[i]/X) - 1
    if Cut <= K:
        high = X
        Cancut = X
    else:
        low  = X
# 出力
Cancut = int( 10 * Cancut) / 10
print(math.ceil(Cancut))
N,K = map(int,input().split())
arr = list(map(int,input().split()))
denominator = sum(arr)

piece = [(K+N)*arr[i]//denominator+1 for i in range(N)]
value = [arr[i]/piece[i] for i in range(N)]

left = K-sum(piece)
for i in range(left):
    j = value.index(max(value))
    piece[j] += 1
    value[j] = arr[j]/piece[j]

print(round(max(value)))
from math import ceil

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


def is_ok(num):
  t = 0
  for log in logs:
    if log <= num:
      continue
    t += ceil(log / n) - 1
  return t <= k

ng = 0
ok = 10 ** 9

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

print(ceil(ok))
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) + 1

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(int(min_A) + 1)
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=max(a),0
while l-r>1:
    t=(l+r)//2
    c=0
    for i in a:
        c+=i//t
    if c>k:
        r=t
    else:
        l=t
print(l)
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

def counter(x):
  cnt=0
  for i in a:
    cnt+=i//x
    
  if cnt>k:
    return True
  
  else:
    return False

high=a[-1]
low=0
while (high-low)>1:
  mid =(high+low)//2
  if counter(mid):
    low=mid

  else:
    high=mid

print(high)
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
start = 0
end = A[-1]
l = (start + end)/2
while end - start >= 0.001:
   l = (start + end)/2
   count = 0
   for i in range(N):
      q, mod = divmod(A[i], l)
      if mod == 0.0:
         q -= 1
      count += q
   if count > K:
      start = l
   else:
      end = l
ans = (start + end)/2
print(int(end)+1)
N,K = map(int,input().split())
A = list(map(int,input().split()))
low = 0
high = 10**9
while high-low>1:
    mid = (high+low)//2
    cnt = 0
    for i in range(N):
        cnt += A[i]//mid
    if K>=cnt:
        high = mid
    else:
        low = mid
print(high)
import numpy as np
import math

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

def isOK(minVal):
	tmpK=0
	for a in A:
		# math.ceil(a//minVal)-1
		tmpK+=((-(-a//minVal))-1)

	if tmpK <= K:
		return True
	else:
		return False

ok = max(A)
ng = 0

while (math.ceil(ok) != math.ceil(ng)):
	mid = (ok+ng) / 2
	if isOK(mid):
		ok = mid
	else:
		ng = mid
	print(ok,ng)

print(math.ceil(ok))
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
X = max(A)
if K == 0:
    print(X)
    exit()
else:
    for i in range(1, 32):
        B = []
        for a in A:
            b = math.ceil(a / X) - 1
            B.append(b)
        B_total = sum(B)
        if B_total > K:
            X += int(max(A) / pow(2, i))
        else:
            X -= int(max(A) / pow(2, i))
    print(X)
n, k = map(int, input().split())
a = list(map(int, input().split()))

low = 0
high = max(a)

while low + 1 < high:
    print(low, 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()))

OK = 10**9
NG = 1

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)
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**-5

while abs(r-l) > eps:

    m = (r+l)/2

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

print(ceil(r))
from math import floor

m=1
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)
import math
n,k = map(int, input().split(' '))
a_s= list(map(int, input().split(' ')))

tot=0
for log in a_s:
	tot+= log
table={}

ans= 0


for log2 in a_s:
	test= math.ceil(log2/ ((math.ceil(log2/tot*k))+1))
	if test>ans:
		ans=test
print(ans)
n,k = list(map(int,input().split()))
f = list(map(int,input().split()))

s = (10**9) // 2
step = s
best= 999999999999
import math

for j in range(40):
  c = 0
  arr = list(f)
  for i in range(n):
    c += arr[i] // s
    arr[i] /= (c+1)
    
  step = step//2
  step = max(1, step)
 
  if c<=k:
    s -= step
    best = min(best,math.ceil(max(arr)))
  else:
    s += step
      
print(best)
from sys import stdin

input = stdin.readline
import math
import heapq


def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    left = 1
    right = max(a)

    def ok(l):
        s = sum([(i-1) // l for i in a])
        return s <= k
    print(max(a))
    while left < right:
        mid = (left + right) // 2
        if ok(mid):
            right = mid
        else:
            left = mid + 1
    print(left)


if __name__ == '__main__':
    solve()
# -*- coding: utf-8 -*-

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

def num_cut(L):
  result = 0
  for a in A:
    result += a//L
    if a%L == 0:
      result -= 1
  return result

m = 1
M = 10**9

while M-m>1:
  X = (m+M)//2
  if num_cut(X)>K:
    m = X
  else:
    M = X

print(M)
import copy
import math

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

ub = 10**9
lb = 0

while ub - lb > 0.0001:
    x = (ub + lb) / 2
    cnt = 0
    for i in a:
        cnt += math.ceil(i/x)
    if cnt <= n+k:
        ub = copy.deepcopy(x)
    else:
        lb = copy.deepcopy(x)
ans = round(ub, 3)
print(math.ceil(ans))
import math

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

def isPossible(X):
    global N, K, A

    cuts = 0
    for i in range(N):
        cuts += math.ceil(A[i]/X) - 1
    
    return cuts <= K

minVal = 0
maxVal = max(A)

while maxVal - minVal >= 1:
    if isPossible((maxVal + minVal) / 2):
        maxVal = (maxVal + minVal) / 2
    else:
        minVal = (maxVal + minVal) / 2

print(math.ceil((maxVal + minVal) / 2))
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
  print(max(A))
  exit()
def f(x):
  cnt=0
  for i in A:
    if i%x==0:
      cnt+=i//x-1
    else:
      cnt+=(i//x)
  if cnt<=K:
    return True
  else:
    return False
ok=1
ng=1000000000
for i in range(50):
  mid=(ok+ng)//2
  if f(mid):
    ng=mid
  else:
    ok=mid
print(ok)
#!/usr/bin/env python3
from math import ceil

EPS = 1e-8
n, k = map(int, input().split())
a = list(map(int, input().split()))


def f(p):
    c = 0
    for x in a:
        c += x // p
    return c


ok, ng = 0, max(a)
while abs(ok - ng) > 1:
    m = (ok + ng) // 2
    if f(m) > k:
        ok = m
    else:
        ng = m
print(ok + 1)
# logs
import bisect
import math
k = int(input().split()[1])
# a = list(map(int, input().split()))
tmp = input().split()
a = [int(s) for s in tmp]
a.sort()
# print(a)
for i in range(k):
	x = a.pop()/2
	pos = bisect.bisect_right(a, x)
	a.insert(pos, x)
	# print(a)
print(math.ceil(a.pop()))
from math import floor
N, K = map(int,input().split())
A = list(map(int,input().split()))
def chk(L):
    cnt = 0
    for i in range(N):
        cnt += floor(A[i]/L)
    return cnt <= K
l, r = 1, max(A)
for _ in range(100):
    m = (l+r)/2
    if chk(m):
        r = m
    else:
        l = m
print(round(m))
import math
N, K = map(int, input().split())
Alst = list(map(int, input().split()))

for i in range(K):
    sa = Alst.index(max(Alst))
    Alst.append(Alst[sa]/2)
    Alst[sa] = Alst[sa]/2

print(math.ceil(max(Alst)))
import numpy as np
import math
N, K = map(int, input().split())
aaa = np.array(list(map(float, input().split())), dtype='float64')
ng = 0
ok = 10 ** 9
e = 10 ** -7
while ok > ng + e:
    mid = (ng + ok) / 2
    bbb = aaa // mid
    if bbb.sum() <= K:
        ok = mid
    else:
        ng = mid
print(math.ceil(round(ok, 7)))
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=max(a),1
while l-r>1:
    t=(l+r)//2
    c=0
    for i in a:
        c+=(i-1)//t
    if c>k:
        r=t
    else:
        l=t
print(l)
import numpy as np
import math

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

a.sort()
a.reverse()
total = sum(a)

# 期待値
mn = 1/ (k+1)
a = np.array(a)
b = a

# 割合
ab = a/total

# 少なくとも何回切れるか
a = ab//mn

# 切った後の長さ
f = b/(a+1)

# 大きい順に並べて
f = np.sort(f)[::-1]

# あと何回切れるか
sm = sum(a)
left = int(k - sm)

print(math.ceil(f[left]))
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.001:
      break
  print(math.ceil(ans))