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

def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    
    l,r = 0, max(A)
    while l < r-1:
        mid = (l+r)//2
        cnt = 0
        for a in A:
            cnt+= a//mid
            
        if cnt <= K:
            r = mid
        else:
            l = mid
    print(r)
    
main()
rule=input().split()
N=int(rule[0])
K=int(rule[1])
data=input().split()
data_int=[int(s) for s in data]
data_count=[0]*len(data)
import math
for i in range(K):
    x=data_int.index(max(data_int))
    data_int[x]=math.ceil(data_int[x]*(data_count[x]+1)/(data_count[x]+2))
    data_count[x]+=1
print(math.ceil(max(data_int)))
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= 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()))

m = 0
M = max(A)

while(M-m>0.01):
    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))
#E - Logs
import math
# 入力
N,K = map(int,input().split())
A   = list(map(int,input().split()))
Amax = int(max(A))
high = Amax
low  = 1
while ( low <= high ) :
    Cut = 0
    X = (high + low) / 2
    for i in range(N):
        if A[i] >= X:
            Cut = Cut + math.floor(A[i]/X) - 1
    if Cut < K:
        high = X - 1
    else:
        low  = X + 1

# 出力
print(int(X)+1)
n, k = map(int, input().split())
a = list(map(int, input().split()))

def c(x):
    cnt=0
    for i in a:
        cnt += i // x
    return cnt <= k
    
l, r = 0, max(a)
while l + 1 < r:
    mid = (l + r) // 2
    if c(mid):
        r = mid
    else:
        l = mid
        
print(r)
import math
N, K = map(int, input().split())
A=list(map(int,input().split()))
right = 20000000000000
left = 0
while(right-left>1):
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count > K:
        left = mid
    else:
        right = mid
print(mid)
n, k = map(int, input().split())
a = [int(x) for x in input().split()]

lo = 1
hi = max(a)

def ok(x):
    cuts = 0
    for log in a:
        cuts += log // x

    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)
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=1,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(max(1,t-1)))
N,K = map(int,input().split())
arr = list(map(int,input().split()))
denominator = sum(arr)

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

value = [arr[i]/piece[i] 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]

print(round(max(value)))
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(lower) if k > 0 else a[-1])


if __name__ == '__main__':
    main()
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(_min))
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-1
    else:
        l = mid+1
print(l)
import sys
import math

input = sys.stdin.readline

def can(arr, m, K):
  need = 0
  for x in arr:
    need += int(x // m)
  return need <= K

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

lo = 0.0
hi = 1e9

while (abs(lo - hi) > 1e-3):
  m = (lo + hi) / 2.0
  if (can(arr, m, K)):
    hi = m
  else:
    lo = m
ans = lo

print(int(math.ceil(lo)))
from heapq import heappush, heappop
from math import ceil, floor
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ng, ok = 0, 10 ** 9
for _ in range(40) :
  mid = (ng + ok) / 2
  ret = 0
  for a in A :
    ret += floor(a / mid)
  if ret <= K :
    ok = mid
  else :
    ng = mid
    
print(ceil(ng))
n, k = map(int, input().split())
a = list(map(int, input().split()))

hi = 10 ** 9
lo = 1
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)
from math import ceil


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ok = 0
    ng = 10 ** 9 + 7
    while abs(ok - ng) > 0.5:
        mid = (ok + ng) / 2
        cnt = 0
        for i in range(n):
            cnt += ceil(a[i] / mid) - 1
        if k < cnt:
            ok = mid
        else:
            ng = mid
    print(ceil(ok))


if __name__ == '__main__':
    main()
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
for i in range(L):
    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 math
n, k = map(int, input().split())
aas = list(map(int, input().split()))
diff = pow(10,-6)
left = 1
right = 10**9
def judge(mid):
    cut = 0
    for i in aas:
        cut += math.ceil(i / mid) - 1
    if cut <= k:
        return True
    else:
        return False
while left < right:
    mid = (left + right) / 2
    if (left <= right <= left + diff) or (right <= left <= right + diff):
        break
    elif judge(mid):
        right = mid
    else:
        left = mid
print(math.ceil(right))
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
for i in range(k):
  t=max(a)
  a.insert(0,t/2)
  a.remove(t)
print(math.ceil(max(a)))
import copy
n,k = map(int, input().split())
a = list(map(int, input().split()))

num_cut = [1]*n
cut_list = copy.copy(a)

for i in range(k):
    max_index = cut_list.index(max(cut_list))
    num_cut[max_index] += 1
    cut_list[max_index] = a[max_index] / num_cut[max_index]
    #print("a",a)
    #print("cut_list", cut_list)
    #print("num_cut",num_cut)

print(int(max(cut_list)))
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)

from collections import deque
da=deque(a)
db=deque()
for ii in range(k):
  #print(da,db,len(da),len(db))
  if len(da)>0:
    a0=da.popleft()
  else:
    a0=db.popleft()
  #print(da,db)
  if len(db)>0 and db[0]>a0:
    da.append(a0)
    db.popleft()
  else:
    db.append(a0/2)
    db.append(a0/2)
import math
if len(da)>0:
  a0=da.popleft()
else:
  a0=db.popleft()

print(math.ceil(a0))
#!/usr/bin/env python3

import math

numbers = input().split(" ")
n = int(numbers[0])
k = int(numbers[1])

numbers = input().split(" ")

a1 = [int(x) for x in numbers]
a2 = [[i, a1[i], 0] for i in range(n)]

#a2.sort(key=lambda x: x[1])

for i in range(k):
    a2.sort(key=lambda x: x[1])
    a2[-1][1] /= 2
    a2[-1][2] += 1

a2.sort(key=lambda x: x[2])

for i in range(n):
    a1[i] /= (a2[i][2] + 1)

a1.sort()

print(math.ceil(a1[-1]))
N,K = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]
m = [[]]*N
c = [1]*N
for i in range(N):
    m[i] = A[i]
for i in range(K):
    #print(m)
    I = m.index(max(m))
    c[I] += 1
    m[I] = A[I]/c[I]
print(round(max(m)))
import math
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
def mul(n):
  return n/a[0]
b=list(map(mul,a))
sum=sum(b)
c=[0]*n
cnt=k
for i in range(n):
  c[i]=int(k*b[i]//sum)
  cnt-=c[i]
  a[i]/=(c[i]+1)

print(math.ceil(a[::-1][cnt]))
N,K = map(int,input().split())
A = list(map(int,input().split()))

def is_ok(l):
    if l<=0: return False
    k = 0
    for a in A:
        k += a//l
        if k > K:
            return False
    return True

ok = 10**9+1
ng = -1
while ok - ng > 1:
    m = (ok+ng)//2
    if is_ok(m):
        ok = m
    else:
        ng = m
print(ok)
import copy

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

sum_a = sum( a )

devide = [ k * a[ i ] // sum_a for i in range( n ) ]
dev_len = [ a[ i ] / ( devide[ i ] + 1 ) for i in range( n ) ]
k -= sum( devide )
dev_len = list( map( float, dev_len ) )

for _ in range( k ):
    max_i = dev_len.index( max( dev_len ) )
    devide[ max_i ] += 1
    dev_len[ max_i ] = a[ max_i ] / ( devide[ max_i ] + 1 )

print( int( max( dev_len ) + 0.5 ) )
import math

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

values = []

for i in range(K+1):
    values.append([0]*N)
    for j in range(N):
        values[i][j] = A[j] / (K - i + 1)

values_flatten = sum(values, [])
values_flatten.sort()

min_val = values_flatten[K*(N-1)]

cuts = []

for j in range(N):
    for i in range(K+1):
        if values[i][j] >= min_val:
            cuts.append(values[i][j])
            break

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

left = 0
right = 10**10


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))
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):
    high=mid

  else:
    low=mid

print(high)
import math

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

ideal = sum(A) / (N+K)
max_hitsuyou = [math.floor(a/ideal) for a in A]
candidate = [math.ceil(a/need) for a, need in zip(A, max_hitsuyou) if need != 0]
#print(candidate)

min_len = 1e10
for c in candidate:
    if sum(math.ceil(a/c) for a in A) == N+K:
        #print(c)
        min_len = min(min_len, c)

print(min_len)
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(0)
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 = map(int,input().split())
arr = list(map(int,input().split()))
denominator = sum(arr)

#piece = [K*arr[i]//denominator+1 for i in range(N)]
#value = [arr[i]/piece[i] for i in range(N)]
#print(piece)
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(max(value)))
n, k = map(int, input().split())
a = list(map(int, input().split()))
low = min(a)
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)
#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.001
        Cancut = X
    else:
        low  = X + 0.001
# 出力
print(math.ceil(Cancut))
def check(A, K, L):
    i = 0
    for a in A:
        i += a//L
        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(l+1)
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] + 100
    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(lower) if k > 0 else a[-1])


if __name__ == '__main__':
    main()
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n, k=  map(int, input().split())
A =list(map(int, input().split()))
s = sum(A)
X = []
for i in A:
    X.append(math.ceil(k*i/s))
    #x = round(k*i/s, 1)
    #X.append(Decimal(str(x)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
Y = []
for j in range(n):
    Y.append(A[j]/(X[j]+1))
print(math.ceil(max(Y)))
#print(X)
#二分探査かぁ…
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=max(A)
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)
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 1

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)
#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))
from heapq import heappush, heappop
from math import ceil, floor
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ng, ok = 0, 10 ** 9
for _ in range(40) :
  mid = (ng + ok) / 2
  ret = 0
  for a in A :
    ret += floor(a / mid)
  if ret <= K :
    ok = mid
  else :
    ng = mid
  print(ok, ng)
    
print(ceil(ng))
n, k = map(int, input().split())
A = [*map(int, input().split())]
l, r = 1, max(A)+1 # [l,r)
while r - l > 1:
    m = (l + r) // 2
    c = 0
    for a in A: c += (a+m-1) // m - 1
    if c <= k: r = m
    else: l = m
print(r)
import math


N, K = map(int, input().split())
logs = list(map(int, input().split()))
longest_log = max(logs)

if K == 0:
    print(longest_log)
    exit()

def count_cut(log, size):
    return math.floor(log/size)

left, right = 1, longest_log
while left <= right:
    pivot = left + (right - left) // 2
    count = sum(count_cut(log, pivot) for log in logs)
    if left == right:
        break
    if count > K:
        left = pivot + 1
    elif count < K:
        right = pivot - 1
        #right = pivot

print(pivot)
import math

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

l= 0.0
r= 1000000000.0
while(r-l>0.0001):
    mid = (l+r)/2
    abc=1
    cnt=0
    for i in range(n):
        x = math.floor(a[i]/mid)
        cnt+=int(x)
    if(cnt>k):
        abc=0
    if(abc==1):
        r=mid
    else:
        l=mid

print(int(round(r)))
import math
N, K = map(int, input().split())

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

def cal(x):
    s = 0
    for aa in a:
        s += math.ceil(aa/x) - 1
    if s <= K: return True
    else: return False

l = 1
r = max(a)
while abs(r - l) > 1:
    mid = (l + r) // 2
    if cal(mid):
        r = mid
    else:
        l = mid
print(r)
import math

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

def ink(L):
    cnt = 0
    for i in range(N):
        cnt += A[i]//L
    return cnt <= K

bottom, top = 0, max(A)

while(top - bottom > 1):
    middle = (top + bottom) // 2
    if ink(middle): top = middle
    else: bottom = middle

print(top)
from bisect import *
from heapq import *
import math
mod = 10**9+7
N, K = map(int, input().split())
A = list(map(int, input().split()))
ep = 0.1
l = 0.0
r = 10**9+1
while l+ep < r:
    x = (l+r)/2
    k = 0
    for a in A:
        k += math.ceil(a/x)-1
        if k > K:
            break
    if k <= K:
        r = x
    else:
        l = x
print(math.ceil(l))
from queue import PriorityQueue
N, K = map(int, input().split())
A = list(map(int, input().split()))
pq = PriorityQueue()
for a in A:
    pq.put(-a)
for _ in range(K):
    now = pq.get()
    # print("取り出した値 : ", now)
    a, b = now/2, now/2
    # print("切り出し : ", a, b)
    pq.put(a)
    pq.put(b)
print(int(-pq.get()))
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(ok)
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 lower + 1 < upper:
        target = (lower + upper) / 2
        now = 0
        for i in range(n):
            now += floor(a[i] / target)
        if now > k:
            lower = target
        else:
            upper = target
    print(floor(upper) if k > 0 else a[-1])


if __name__ == '__main__':
    main()
import sys

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

def main():
    N,K = map(int,input().split())
    A = sorted(list(map(int,input().split())))
    left = 0
    right = A[-1]

    while right - left > 1:
        cnt = 0
        middle = (left + right) // 2
        for i in A:
            cnt += i // middle
        if cnt <= K:
            right = middle
        else:
            left = middle
    print(right)


if __name__ == "__main__":
    main()
n, k = map(int, input().split())
A = [*map(int, input().split())]
l, r = 1, 10**9 + 1 # [l,r)
while r - l > 1:
    m = (l + r) // 2
    c = 0
    for a in A: c += (a+m-1) // m - 1
    if c <= k: r = m
    else: l = m
print(r)
import math

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

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

print(math.ceil(max(A)))
N, K = map(int, input().split())
L = list(map(int, input().split()))

if K == 0:
	print(max(L))
	exit()

import math

def is_ok(arg):
	count = 0
	for i in range (0, N):
		count+=math.floor(L[i]/arg)
	return count <= 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, max(L)))
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
ok = a.max()
ng = 1

from math import ceil

def f(length):
  rtn = int((np.ceil(a/length) - 1).sum())
  return rtn

if f(1) == 0:
  print(0)
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 = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
M = max(A)
l,r = 1,M
cnt = 0
ans = float('inf')
while l<=r:
    cnt = 0
    mid = (l+r)//2
    for a in A:
        cnt += a//mid
    if cnt <=k:
        ans = min(ans,mid)
        r = mid-1
    else:
        l = mid+1
print(ans)
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//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 = list(map(int, input().split()))

for i in range(1, 10**5):
    cnt = 0
    for a in A:
        cnt += math.ceil(a/i) - 1
    
    if cnt <= K:
        print(i)
        exit()
import heapq
import math

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

heapq.heapify(logs)

for _ in range(K):
  log, i = heapq.heappop(logs)
  heapq.heappush(logs, (log*(i+1)/(i+2),i+1))
  print(logs)
  
log, i = heapq.heappop(logs)
print(math.ceil(-log))
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

low=1
high=2*max(A)
X=max(A)
while low<=high:
  mid=(low+high)//2
  cnt = 0
  for i in range(N):
      cnt += A[i]//mid
  if K<cnt:
    low=mid+1
  else:
    X=min(X,mid)
    high=mid-1
print(X)
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(maxVal))
import sys
import math

input = sys.stdin.readline

def can(arr, m, K):
  need = 0
  for x in arr:
    need += int(x // m)
  return need <= K


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

ans = 0.0

if K == 0:
  ans = max(arr)
else:
  lo = 0.0
  hi = 1e9

  while (abs(lo - hi) > 1e-5):
    m = (lo + hi) / 2.0
    if (can(arr, m, K)):
      hi = m
    else:
      lo = m
  ans = lo

print(int(math.ceil(ans)))
n,k=map(int,input().split())
a=list(map(int,input().split()))
def case(L):
    result=0
    for x in a:
        result+=x//L
    return result
possible=0
impossible=max(a)
while impossible-possible>1:
    M=(impossible+possible)//2
    if case(M)>k:
        possible=M
    else:
        impossible=M
print(impossible)
import math

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


def nibun(l, r):
  if r - l < 1:
    return (r + l) / 2
  cnt = 0
  x = (r + l) / 2
  for i in a_list:
    cnt += math.ceil(i/x) - 1
  if cnt <= k:
    return nibun(l, x)
  else:
    return nibun(x, r)
  
if k == 0:
  print(max(a_list))
else:
  print(math.ceil(nibun(0, max(a_list))))
n,k = map(int, raw_input().split())
ais = map(int, raw_input().split())

def p(m,ais,k):
	t = [ m, ais, k]
	for ai in ais:
		k-= ai / m
	return k >=0

lo,hi = 1, max(ais)
#print lo,hi
while(lo < hi):
	med = (lo + hi)/2
	if p(med, ais, k):
		hi = med
	else:
		lo = med + 1

print lo
import math

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

left = 0
right = max(A)

while right - left > 1:
    mid = (left + right) // 2
    jk = 0
    for i in range(N):
        jk += A[i] / mid - 1
        if A[i] % mid == 0: jk += 1
    if jk <= K:
        right = mid
    else:
        left = mid

print(right)
N ,K = map(int, input().split())

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 1
max = max(A)

while True:
    X = (min + max)//2 
    for i in range(N):
        d[i] = A[i]//X
    if sum(d) <= K:
        max = X
    else:
        min = X
    #print(min, max)
    
    if min + 1 == max:
        print(int(max))
        break