peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
  print(max(a))
  sys.exit()
def check(t):
  ans = 0
  for aa in a:
    if aa > t:
      ans += aa//t
  if ans > k:
    return False
  else:
    return True
max = 10**9
min = 0
while max-min>1:
  mid = (max+min)/2
  if check(mid):
    max = mid
  else:
    min = mid
print(int(max)+1)
n,k = map(int,input().split())
L = list(map(int,input().split()))

def A(x):
    cnt = 0
    for i in range(n):
        cnt +=L[i]//x
    return cnt <= k

lower = 0
upper = max(L)

while upper - lower > 1:
    mid = (lower + upper)//2
    if A(mid):
        upper = mid
    else:
        lower = mid

print(upper)
from sys import stdin
from sys import setrecursionlimit
import numpy as np
import math

setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))

a.sort()
a = np.array(a,dtype=np.int64)

low = -1
hi = 10**9
point = 0

while point <= 1000:
    ave = (hi+low)/2
    if np.maximum(0,a//ave).sum() <= k:
        hi = ave
    else:
        low = ave
    point += 1

print(math.ceil(ave))
def check(lis,k,mid):
	for i in lis:
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=min(lis),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)
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.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()
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.0000001:
   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)
def binary_search2(func, n_min, n_max):
    left,right=n_min,n_max
    y_left, y_right = func(left), func(right)
    while True:
        middle = (left+right)//2
        y_middle = func(middle)
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left
  
def f(x):
  return sum([A[i]//x for i in range(N)])<=K

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

print(binary_search2(f, 1, max(A))+1)
import math
import heapq
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n):
    a[i] = -math.log2(a[i])
heapq.heapify(a)
for _ in range(k):
    heapq.heappush(a, heapq.heappop(a)+1)

print(a)
print(int(-(-2**(-1*heapq.heappop(a))//1)))
n,k = map(int,input().split())
A = list(map(int,input().split()))
ng = 0
ok = max(A)

def queri(n):
    count = 0
    for i in A:
        count += -(-i//n)
    if k>= count:
        return True
    else:
        return False

while ok - ng > 1:
    mid = (ok+ng)//2
    if queri(mid) :
        ok = mid
    else:
        ng = mid
print(ok)
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

def isfeasible(L):
  k = 0
  for i in range(N):
    a = A[i]
    if a < L:
      break
    if a%L == 0:
      dk = a//L - 1
    else:
      dk = a//L
    k += dk
    if k > K:
      return False
  return True

l = 0
r = A[0]
if K == 0:
  print(A[0])
else:
  while r-l>1:
    L = (r+l)//2
    if isfeasible(L):
      r = L
    else:
      l = L+1
  print(r)
#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.01 ) :
    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( 100 * Cancut) / 100
print(math.ceil(Cancut))
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 = 1
right = 10 ** 9

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

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

print(math.ceil(m))
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, 1))
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(40):
    x = (l + r) / 2
    if check(x) > k:
        l = x
    else:
        r = x
print(math.ceil(l))
import math
n,k = map(int,input().split())
a_list = list(map(int,input().split()))

min_num = 1
max_num = 10**9+1
while True:
    print(min_num)
    x = int((min_num+max_num)/2)
    if sum([math.ceil(a/x)-1 for a in a_list])>k:
        min_num = x
    else:
        max_num = x
    if max_num-min_num<=1:
        break
    #print(x)
if sum([math.ceil(a/min_num)-1 for a in a_list])>k:
    print(min_num+1)
else:
    print(min_num)
from math import ceil
n,k = map(int,input().split())
a = list(map(int,input().split()))

print(n,k,a)

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)
import math

def main():
    _, k = map(int, input().split())
    arr = list(map(int, input().split()))
    print(arr)
    l, r = 1, 1000000000
    while l < r:
        m = (l + r) // 2
        cnt = 0
        for val in arr:
            cnt += math.ceil(val / m) - 1
        if cnt > k:
            l = m + 1
        else:
            r = m
    print(l)
  
if __name__ == '__main__':
    main()
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:
    if i > now:
      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()))
A.sort()

hi = 10**18
lo = 1

while hi - lo > 1:
    mid = (hi + lo) // 2
    cut = 0
    for i in range(N):
        cut += (A[i] + mid - 1) // mid - 1
    if cut <= K:
        hi = mid
    else:
        lo = mid

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

def possible(l):
    c = 0
    for i in range(N):
        n = A[i]//l
        c += n
    return c<=K

l = 0
r = max(A)
m = (l+r)/2
for i in range(32):
    pos = possible(m)
    if pos:
        r = m
    else:
        l = m
    m = (l+r)/2

print(ceil(m))
import math


nk=input()
nn=nk.split()
n=int(nn[0])
k=int(nn[1])
aa=input()
a=aa.split()
for i in range(0,n):
  a[i]=int(a[i])

a.sort(reverse=True)
for i in range(0,k):
  a[0]=a[0]*0.5
  a.sort(reverse=True)
  

print(math.ceil(a[0]))
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(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=mp()
a=sorted(lmp())
ans=10**10
l=1
r=a[-1]
while True:
    print(l,r)
    if l==r-1:
        print(r)
        exit()
    m=(l+r)//2
    c=0
    for i in a:
        c+=-(-i//m)-1
    if c>k:
        l=m
    else:
        r=m
from sys import stdin
from sys import setrecursionlimit
import numpy as np
import math

setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))

a.sort()
a = np.array(a,dtype=np.int64)

low = 0
hi = 10**9
point = 0

while hi-low > 0.00001:
    ave = (hi+low)/2
    if np.ceil(a//ave).sum() <= k:
        hi = ave
    else:
        low = ave

print(math.ceil(ave))
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 abs(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),ans)
      tmax=t
    else:
      tmin=t
  print(ans)
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):
        if a[i]==mean_a: continue
        count -= -a[i]//mean_a
    if count >= 0:
        max_a = mean_a
    else:
        min_a = mean_a

print(max_a)
import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
  print(max(a))
  sys.exit()
def check(t):
  ans = 0
  if t==0:
    return False
  for aa in a:
    if aa > t:
      ans += aa//t
  if ans > k:
    return False
  else:
    return True
max = 10**9+1
min = 0
while max-min>0.001:
  mid = (max+min)/2
  if check(mid):
    max = mid
  else:
    min = mid
print(math.ceil(max))
import math
n,k = map(int,input().split())
a_list = list(map(int,input().split()))

min_num = 1
max_num = 10**9+1
while True:
    x = int((min_num+max_num)/2)
    if sum([math.ceil(a/x)-1 for a in a_list])>k:
        min_num = x
    else:
        max_num = x
    if max_num-min_num<=1:
        break
    #print(x)
print(int(max_num))
rule=input().split()
N=int(rule[0])
K=int(rule[1])
data=input().split()
ans=0
for i in range(len(data)):
    ans+=int(data[i])
import math
print(math.ceil(ans/(K+1)))
# でつ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 - 10**-9))

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)
import math 
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)

while(right-left>=1):
    numofcut=0
    
    for i in range(N):
        numofcut+=math.ceil(A[i]/mid)
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)
def is_ok(X):
    cnt = 0
    for a in A:
        cnt += a//X
    if cnt <= k:
        return True
    else:
        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 = map(int,input().split())
A = list(map(int,input().split()))

print(meguru_bisect(0,max(A)+1))
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(b)
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
xma=a[-1]
x=a[-1]//2
xmi=0
xo=-1
while abs(x-xo)>0.0001:
  k2=k
  for i in range(n):
    j=1
    while a[i]/j>x:
      j+=1
      k2-=1
  if k2<0:
      xo=x
      xmi=x
      x=(xma+x)/2
  else:
    xo=x
    xma=x
    x=x/2
import math
print(math.ceil(x))
from math import *

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

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

low = 0
high = 1000000000
ans  =-1

while low < high:
	mid = (low + high)/2
	cut = trycut(mid)
	# ~ print("low=",low, "high=", high,"val = ",mid,"ret = ",cut)
	if cut <= k:
		high = mid-0.0000001
		ans = mid
	else:
		low =  mid+0.0000001
	# ~ if low < high: print(low, high, "je reviens")
print(round(ans))
n,k = map(int, input().split())
a = list(map(int, input().split()))


a.sort()

if k==0:
    print(max(a))
    exit()

def solve(num):
    ret=0
    for tmp in a:
        ret+= tmp//num
    return k>=ret

l=0
r=10**18
while r-l>1:
    mid=(l+r)//2

    if solve(mid):
        r=mid
    else:
        l=mid
print(min(max(a),r))
# 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+0.5 < 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()))
low = 0
top = max(a)

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)
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 = 1
r = 10**9+1 
while r - l > 1:
    mid = (l + r) // 2
    if f(mid) <= K:
        r = mid
    else:
        l = mid
print(r)
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 = 1

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

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

_min = 0
_max = max(A)

while int(_min)<int(_max):
  new = (_min+_max)/2
  times = sum([math.floor(a/new) for a in A])
  #print(new, times)
  if times <= K:
    _max = new
  else:
    _min = new
    
print(math.ceil(_max))
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+1
print(left)
#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.0
    for i in range(N):
        Cut = Cut + math.ceil(A[i]/X) - 1
    if Cut <= K:
        high = X - 0.01
        Cancut = X
    else:
        low  = X + 0.01
# 出力
#Cancut = int( 100 * Cancut) / 100
print(math.ceil(Cancut))
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 = int((ok + ng) / 2)
    if solve(K, N, A, mid):
        ok = mid
    else:
        ng = mid

print(math.ceil(ok))
from bisect import bisect_left,bisect
import math

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

m = 0
M = max(A) + 1

while M - m > 1:
  temp = (M + m) // 2
  L = bisect(A, temp)
  cnt = 0
  for i in range(L, N):
    p, q = divmod(A[i], temp)
    if q == 0:
      cnt += p-1
    else:
      cnt += p
  if cnt <= K:
    M = temp
  else:
    m = temp

print(temp)
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] *= -1
import heapq
heapq.heapify(A)
for i in range(K):
    m = heapq.heappop(A)
    heapq.heappush(A,m/2)
a = min(A)
a *= -1
if a == int(a):
    print(int(a))
else:
    print(int(a) + 1)
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    left = 1
    right = 10 ** 9 + 1
    while right - left > 1:
        mid = (right+left) // 2
        cnt = 0
        for a in A:
            cnt += (a-1) // mid
        
        if cnt <= K:
            right = mid
        else:
            left = mid

    print(right)
    
if __name__ == '__main__':
    solve()
from math import ceil

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

l_lb, l_min = 1, max(A)
while l_min - l_lb > 1:
  l_mid = (l_lb + l_min) // 2
  if sum(ceil(a/l_mid) for a in A) - N > K:
    l_lb = l_mid
  else:
    l_min = l_mid
print(l_min)
n,k,*a=map(int,open(l:=0).read().split())
r=9**9
while~l+r:
 x=l+r>>1
 if-sum(-b//x+1for b in a)>k:l=x
 else:r=x
print(r)
#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.01
        Cancut = X
    else:
        low  = X + 0.01
# 出力
print(math.ceil(Cancut))
import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
  print(max(a))
  sys.exit()
def check(t):
  ans = 0
  for aa in a:
    if aa > t:
      ans += aa//t
  if ans > k:
    return False
  else:
    return True
max = 10**9
min = 0
while max-min>0.001:
  mid = (max+min)/2
  if check(mid):
    max = mid
  else:
    min = mid
print(math.ceil(max))
#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.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 = math.floor( 10 * Cancut) /10.0
print(math.ceil(Cancut))
# にぶたん　二分探索
n, k = map(int, input().split())
A = list(map(int, input().split()))

ok = 1
ng = max(A)

while abs(ok - ng) > 1:
  mid = (ok + ng) // 2
  cnt = 0
  for a in A:
    if a // mid > 1:
      cnt += a // (mid + 1)
  if cnt < k:
    ng = mid
  else:
    ok = mid

ans = 0
for a in A:
  if a >= ok:
    m = a % ok
    ans = max(ans, m)

print(ok + ans)
from math import ceil, floor
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = 0
r = 10**9
m = (l+r)//2+1
for i in range(100):
    # print(l,m,r)
    cnt = 0
    for j in a:
        cnt += (j//m)
    # print(cnt)
    # print(l,m,r,cnt)
    if cnt <= k:
        r = m
        m = ceil((l+r)/2)
    else:
        l = m
        m = ceil((l+r)/2)
print(m)
#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.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 = math.floor( 10 * Cancut) /10.0
print(math.ceil(Cancut))
import math
N, K = map(int, input().split(' '))
A = list(map(int, input(). split(' ')))

for k in range(K):
    i = A.index(max(A))
    A[i] = A[i]/2

print(math.ceil(max(A)))
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 >= 0.5:
    if isPossible((maxVal + minVal) / 2):
        maxVal = (maxVal + minVal) / 2
    else:
        minVal = (maxVal + minVal) / 2

print(math.ceil(minVal))
n,k=map(int,input().split())
A=list(map(int,input().split()))

right=10**9
left=1

while right-left>1 :
    mid=(left+right)//2
    count=0
    for a in A :
        count+=a//mid
        if a%mid==0 :
            count-=1
    if count<=k :
        right=mid
    else :
        left=mid

print(right)
import math
N,K=map(int,input().split())
import heapq
A=list(map(int,input().split()))
h=[(-A[i],1) for i in range(len(A))]
for i in range(K):
  a=heapq.heappop(h)
  b=a[0]
  c=a[1]
  heapq.heappush(h,(c*b/(c+1),c+1))


ans=heapq.heappop(h)
print(math.ceil(-ans[0]))
import math

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

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

middle = math.ceil(max(a) / 2)
oldMiddle = 0
h = middle // 2
rightMin = max(a)

while h > 0:
    cut = 0
    if middle == 0:
        break
    for i in range(n):
        cut += math.ceil(a[i] / middle) - 1
    h = math.ceil(abs(middle - oldMiddle) / 2)
    oldMiddle = middle
    if cut <= k:
        if (middle - h == rightMin):
            break
        middle -= h
    else:
        rightMin = middle
        middle += h

print(middle)
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
else:
    ans=0
    d=round(max(a)*k/sum(a))
    print(-(-max(a)//(d+1)))
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 1
r = max(a)
mid = l+math.ceil((r-l)/2)
while not r-l == 1:
    c = 0
    for x in a:
        c += x//mid
    if c > k:
        l = mid
    else:
        r = mid
    mid = l+math.ceil((r-l)/2)
print(mid)
import math
N, K = map(int,input().split())
logs = list(map(int,input().split()))
a = 0
b = max(logs)
b_memo = set()
count=0
while math.ceil(a) != math.ceil(b):
    c = (a+b)/2
    times = []
    for i in logs:
        times.append(math.floor(i/c))
    if sum(times) > K:
        a = (a+b)/2
    else:
        b = (a+b)/2
    k = len(b_memo)
    b_memo.add(b)
    if len(b_memo) == k:
        count +=1
    if count>50:
        break
print(math.ceil(b))
from heapq import heappush, heappop, heapify
import math
def solve():
	n , k= map(int, input().strip().split())
	if k >= 10*8:
		return 1
	a= [(-int(x),1,int(x)) for x in input().strip().split()]
	heapify(a)
	for i in range(k):
		x,cnt,orig = heappop(a)
		heappush(a,(-((orig+cnt)//(cnt+1)),cnt+1,orig))
	return -(heappop(a)[0])
 
 
print(solve())
n, k = map(int, input().split())
A = list(map(int, input().split()))
if k == 0:
    print(max(A))
    exit()
ans = -(-sum(A) // (n+k))
print(ans)
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))

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

if k == 0:
    print(max(a))
    exit()

l = 1
u = max(a)

while u != l+1:
#    print(l,u)
    c = (l + u) // 2
    cnt = 0
    for i in a:
        cnt = cnt + (i//c)
    if cnt <= k:
        u = c
    else:
        l = c

print(u)
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
if L == int(L):
    print(int(L))
else:
    print(int(L)+1)