peterverebics/CodeNet_Python_118 huggingface dataset:
N,K=map(int,input().split())
A=list(map(int,input().split()))
def f(L):
    res=0
    for x in A:
        res+=(x-1)//L
    return res
l=0
r=max(A)
while r-l>1:
    M=(r+l)//2
    if f(M)>K:
        l=M
    else:
        r=M
print(r)
import math

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

A = []
[N, K] = input().split()
N = int(N)
K = int(K)
A = input().split()
ans = 0

l = 0
r = 10 ** 9

for i in range(N):
  A[i] = int(A[i])

while r - l > 1:
  x = (r + l) // 2
  if is_ok(A, x, K):
    r = x
  else:
    l = x
      
print(r)
N,K = map(int,input().split())
A = list(map(int,input().split()))

def check(m):
    n = 0
    for a in A:
        if a%m == 0:
            n += a//m - 1
        else:
            n += a//m
    return n <= K
        

l = 0
r = 10**9+10

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

print(r)
from math import ceil

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

left = 0
right = max(a)

while right - left > 1:
    length = (right + left) // 2
    totcut = 0
    for i in range(n):
        totcut += ceil(a[i]/length) - 1
        if totcut > k:
            left = length
            break
    else:
        right = length
print(right)
# coding: utf-8
# Your code here!
N,K=map(int,input().split())

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

low=0
high=10**9+1

while high-low!=1:
    mid=(high+low)//2
    cut_temp=0
    ans=-1
    
    for a in A:
        cut_temp+=-(-a//mid)-1
    if cut_temp>K:
        low=mid
    else:
        high=mid
    
print(high)
def count_cuts(a, unit):
    return (a + unit - 1) // unit - 1


def is_good(mid, key):
    return sum(count_cuts(a, mid) for a in A) <= key


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


N, K, *A = map(int, open(0).read().split())
print(binary_search(K))
import math
def is_ok(mid,K,A):
    p = 0
    for i in A:
        p += (i - 1)// mid
    if p > K:
        return False
    else:
        return True
N,K = map(int,input().rstrip().split(" "))
A = list(map(int,input().rstrip().split(" ")))
A.sort()
maxi = A[0]

ng = 0
ok = 10 ** 9
while(abs(ng - ok) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid,K,A):
        ok = mid
    else:
        ng = mid
print(ok)
N,K = map(int,input().split())
A = list(map(int,input().split()))

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

l = 0; r = 10**10
while r-l > 1:
    x = (l+r)//2
    if f(x):
        r = x
    else:
        l = x
print(r)
n, k = map(int, input().split())
a = list(map(int, input().split()))


def ok(l):
    cnt = 0
    for L in a:
        cnt += L // l
        if L % l != 0:
            cnt += 1
        cnt -= 1
    return cnt <= k

#bottom:ng, top:ok
bottom, top = 0, max(a)

while top - bottom > 1:
    mid = (top + bottom) // 2
    if ok(mid):top = mid
    else: bottom = mid

print(top)
N, K = map(int, input().split())
AList = list(map(int, input().split()))

l = 0
r = 10**9
while r-l > 1:
  x = (l + r)//2
  now = 0
  for a in AList:
    now += (a-1)//x
  f = lambda now : True if now <= K else False
  if f(now):
    r = x
  else:
    l = x
print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=0;r=10**10
while r-l>1:
  x=(l+r)//2
  ct=0
  for i in range(n):
    ct+=(a[i]-1)//x
  if ct<=k:
    r=x
  else:
    l=x
print(r)
n, k = map(int, input().split())
a = list(map(int, input().split()))
l, r = 0, 10 ** 9 + 10
while r - l > 1:
    res = 0
    m = (l + r) // 2
    for x in a:
        res += (x - 1) // m
    if res <= k:
        r = m
    else:
        l = m
print(r)
N, K=map(int, input().split())
A=list(map(int, input().split()))

x=0
y=max(A)

def f(l):
  nums=0
  for a in A:
    if a%l==0:
      nums+=a//l-1
    else:
      nums+=a//l
  if nums>K:
    return False
  else:
    return True

while y-x>1:
  tmp=(x+y)//2
  if f(tmp)==True:
    y=tmp
  else:
    x=tmp
    
print(y)
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 = 0
r = max(a)
while r - l > 1:
    mid = (l + r) // 2
    if cal(mid):
        r = mid
    else:
        l = mid
print(r)
import copy
import math

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

ub = 10**9
lb = 0

while ub - lb > 10**-6:
    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, 6)
print(math.ceil(lb))
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
n,k=NM()
hi=10**9
lo=1
l=L()
def f(mi):
    x=0
    for i in l:
        if i<=mi:
            continue
        x+=(i+mi-1)//mi-1
    if x<=k:
        return True
    return False
while hi>=lo:
    mi=(hi+lo)//2
    if f(mi):
        hi=mi-1
    else:
        lo=mi+1
print(lo)
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

def judge(x):
    k = 0
    for a in A:
        v = a // x
        if a % x == 0:
            v -= 1
        k += v
    return k <= K

low = 1
high = max(A)

A.sort()

while low < high - 1:
    mid = (low + high) // 2
    if judge(mid):
        high = mid
    else:
        low = mid

if judge(low):
    print(low)
else:
    print(high)
n,k = map(int, input().split())
l = list(map(int,input().split()))
ok = max(l)
ng = 0

def solver(x):
    cnt = 0
    for logs in l:
        if logs % x == 0:
            cnt += (logs // x) -1
        else:
            cnt += logs// x
    if cnt <= k:
        return True
    else:
        return False

while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if solver(mid) == True:
        ok = mid
    else:
        ng = mid

print(ok)
N,K=map(int,input().split())
A=list(map(int,input().split()))
l,r=1,10**9+1
while r-l>1:
    t=(l+r)//2
    k=sum([(a+t-2)//(t-1)-1 for a in A])
    if K<k:
        l=t
    else:
        r=t
print(l)
n, k = map(int, input().split())
a = list(map(int, input().split()))

low = 0
high = max(a)

while low + 1 < 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()))
a=0
b=10**9+1
while a+1<b:
  mid=(a+b)//2
  ans=0
  for i in A:
    ans+=(i-1)//mid
  if K<ans:
    a=mid
  else:
    b=mid
print(b)
n,k = map(int,input().split())
A = list(map(int,input().split()))

left = 0
right = max(A)

#if accumulate[(ai-1)//k]<=k return True?
def is_ok(x):
  cnt = 0
  for i in range(n):
    cnt += (A[i]-1)//x 
  return cnt<=k
     
#binary search
while (right-left)>1:
  mid = (left+right)//2
  if is_ok(mid):
    right = mid
  else:
    left = mid
    
print(right)
N, K = map(int, input().strip().split())

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

minlen = 0
maxlen = 10**9

while maxlen-minlen > 1:
  mid = (maxlen + minlen)//2
  if mid == 0:
    cur = 1e9
  else:
  	cur = sum((a+mid-1)//mid - 1 for a in A)
  
  if cur > K:
    minlen = mid
  else:
    maxlen = mid

print(maxlen)
from decimal import Decimal
from heapq import heapify, heappop, heappush
N, K = map(int, input().split())
*A, = map(int, input().split())

tot = sum(A)

ng = 0
ok = 10**9

m = 4

while ng + 1 < ok:
    m = (ng+ok)//2
    c = sum((a-1)//m for a in A)
    if c > K:
        ng = m
    else:
        ok = m
print(ok)
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math
l = 0
r = max(a)+1
for _ in range(100):
  m = (l+r)/2
  kn = 0
  for i in a:
    kn += i//m
  if kn > k:
    l = m
  else:
    r = m
print(math.ceil(l))
n,k=map(int,input().split())
arr=list(map(int,input().split()))
def isvalid(mid,k):
    if mid==0:
        return False
    ans=k
    for i in arr:
        if i>mid:
            ans-=i//mid
    return ans>=0


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

def f(t):
    return sum(i//t if i!=t else 0 for i in A)<=K if t else all(i<=t for i in A)

l, r = -1, 10**10
while r-l>1:
    m = (r+l)//2
    if f(m):
        r = m
    else:
        l = m

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

def possible(x):
  cut=0
  for e in maruta:
    if e%x==0:
      cut+=(e//x-1)
    else:
      cut+=e//x
  if cut<=K:
    return True
  else:
    return False

a=1
b=max(maruta)
while b-a>1:
  c=(a+b)//2
  if possible(c):
    b=c
  else:
    a=c

if possible(1):
  print(1)
else:
  print(b)
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
 
def isfeasible(L):
  k = 0
  for a in A:
    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]

while r-l>1:
  L = (r+l)//2
  if isfeasible(L):
    r = L
  else:
    l = L
print(r)
# E - Logs
import sys
sys.setrecursionlimit(1000000)

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

def rec(l,r):
    global N,K,A
    if l==r:
        return l
    tmp = (l+r)//2
    ans = 0
    for i in range(N):
        ans += (A[i]-0.001)//tmp
    if ans<=K:
        return rec(l,tmp)
    else:
        return rec(tmp+1,r)
    
print(rec(1,max(A)))
N, K = map(int, input().split())
arr = list(map(int, input().split()))
def f(x):
    res = 0
    for i in range(N):
        if arr[i] % x != 0:
            res += arr[i]//x
        else:
            res += max((arr[i]//x)-1,0)
    return res
left = 0
right = max(arr)
while abs(left-right) > 1:
    tmp = (left+right)//2
    if f(tmp) > K:
        left = tmp
    else:
        right = tmp
print(right)
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, 1<<32 # (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()))

#  にぶたん！ 半開区間二分探索は正義

def calc(x):
    count = 0
    for a in A:
        count += (a - 1) // x

    return count <= K

A.sort(reverse=True)

r = 10 ** 9
l = 0

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

print(r)
N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
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(50) :
  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))
# ng, ok = 0, 10**9+1

n,k = map(int, input().split())
al = list(map(int, input().split()))
ng, ok = 0, 10**9+1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    ok_flag = True
    # ...
    cnt = 0
    for a in al:
        cnt += (a-1)//mid
    
    if cnt <= k:
        ok = mid
    else:
    	ng = mid
print(ok)
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, max(A) # (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)
from math import floor, ceil

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
l = 0
r = max(a)
while r - l > 1:
    c = (l+r)//2
    cnt = 0
    for i in a:
        cnt += max(ceil(i/c) - 1, 0)
    if cnt <= k:
        r = c
    else:
        l = c
print(r)
n, k = map(int, input().split())
a = list(map(int, input().split()))

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

l, r = 0, 10 ** 9 + 1
while r - l > 1:
    mid = (l + r) // 2 + (l + r) % 2
    if check(mid):
        r = mid
    else:
        l = mid

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

ok, ng = 10**9+1, 0
while abs(ok-ng) > 1:
    mid = (ok+ng) // 2
    # mid = (ok+ng) / 2
    cnt = 0
    for a in al:
        a_cnt = (a-1)//mid
        cnt += max(0,a_cnt)

    if cnt <= k:
        ok = mid
    else:
    	ng = mid

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

ng=0
ok=max(A)


while abs(ok-ng)>1:
    mid=(ok+ng)//2
    
    now=0
    for i in A:
        now+= i//mid-1 if i%mid==0 else i//mid
    if now> k :
        ng=mid
    else:
        ok=mid

print(ok)
import math

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

r = 0
l = 1e9

test_count = 0

while (l - r > 1) :
    target_log_len = (r + l) // 2
    cut_count = 0

    for log_len in A:
        cut_count += (log_len - 1) // target_log_len

    if cut_count <= K:
        l = target_log_len
    else:
        r = target_log_len

    test_count += 1
    if test_count > 100:
        break

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

if sum(A)-n <= k:
    print(1)
    exit()
elif k == 0:
    print(max(A))
    exit()
top = 10**9
bottom = 1
def ok(x):
    res = 0
    for a in A:
        res += (a-1)//x
    return res <= k
while top - bottom > 1:
    mid = (top + bottom)//2
    if ok(mid):
        top = mid
    else:
        bottom = mid
print(top)
n,k,*a = map(int,open(0).read().split())
def func(b):
  c = k
  for i in a:
    c -= (i-1)//b
    if c < 0:
      return False
  return True
l = 1
r = max(a)
while(r>l):
  lr = (l+r)//2
  if func(lr):
    r = lr
  else:
    l = lr + 1
print(r)
from math import ceil

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

a = [int(_) for _ in input().split()]

# a.sort()


l, r = 0, 10**9

while r-l > 1:

    m = (l+r)//2
    c = 0
    for i in range(n):
        if a[i] < m:
            continue
        c += a[i]//m-(a[i] % m == 0)
    # print(c, l, r, m)
    if c > k:
        l = m
    else:
        r = m

print(r)
import heapq
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if k == 0:
    print(a[0])
    exit(0)
mean_a = sum(a) / k
q = []
for aa in a:
    d = max(math.floor(aa / mean_a), 1)
    q.append((-aa/d, d))
    k -= (d-1)
heapq.heapify(q)

for _ in range(k):
    aa, n = heapq.heappop(q)
    heapq.heappush(q, (aa*n/(n+1), n+1))

ans, _ = heapq.heappop(q)
print(math.ceil(-ans))
import math

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

def isOK(X):
    cutcount = 0
    for i in range(N):
        cutcount += math.ceil(A[i] / X) - 1
    if cutcount <= K:
        return True
    else:
        return False

def binary_search():
    left = 0
    right = max(A) + 1

    while (right - left) > 1:
        mid = left + (right - left) // 2
        if (isOK(mid)):
           right = mid;
        else:
            left = mid;

    return right

print(binary_search())
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:
		if ai > m:
			k-= ai / m
	return k >=0

lo,hi = 1, max(ais)

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

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

left = 0
right = 10**9

while right - left > 1:
  
  mid = (left + right) // 2
  
  cut = 0
  for i in range(n):
    cut += -(log[i]//-mid)-1

  if cut > k:
    left = mid
  else:
    right = mid
    
print(right)
def check(N,target,A,K):
  cnt = 0
  for i in range(N):
    cnt += -(-A[i]//target)-1
  if cnt>K:
    return False
  return True

def solve():
  ans = 0
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  low = 1
  high = 10**9+1
  mid = (low+high)//2
  while high>low+1:
    if check(N,mid,A,K):
      high = mid
    else:
      low = mid
    mid = (low+high)//2
  if check(N,low,A,K):
    ans = low
  else:
    ans = high
  return ans
print(solve())
n,k= map(int,input().split())
*A,=map(int,input().split())
l,r=0,10**9
while r-l>1:
    c=(l+r)//2
    if sum(-(-a//c)-1 for a in A)<=k:r=c
    else:l=c
print(r)
N,K = map(int,input().split())
A = list(map(int, input().split()))

X = list(range(1,N+1))
lo = 1
hi = max(A)

while hi-lo>=2:
    mid = (lo+hi)//2
    
    temp = list(map(lambda x:  x//mid - (x%mid==0) ,A))
    if sum(temp) <= K:
        hi = mid
    else:
        lo = mid

temp = list(map(lambda x:  x//lo - (x%lo==0) ,A))

if sum(temp) <= K:
    print(lo)
else:
    print(hi)
from sys import stdin
import numpy as np
n, k = map(int, stdin.readline().split())
a = np.array(stdin.readline().split(), dtype=np.int64)

ng = 0
ok = 10 ** 9 + 1
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if np.sum(0 - - a // mid - 1) <= k:
        ok = mid
    else:
        ng = mid
print(ok)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x0=0
x1=10**9
while(1):
    sum=0
    mid=(x0+x1)//2
    for i in range(n):
        sum+=math.ceil(a[i]/mid)-1
    if(sum<=k):
        x1=mid
    if(sum>k):
        x0=mid
    if(x0+1==x1):
        print(x1)
        break
N, K = map(int, input().split(" "))
logs = list(map(int, input().split(" ")))

def cal( max_length ):
    cut_count = 0 
    for l in logs :
        cut_count += (l//max_length -1)
        if l % max_length != 0 :
            cut_count += 1
    return cut_count <= K 

i = 1 
j = max(logs)
while i < j :
    m = (i+j)//2
    if cal(m) :
        j = m
    else :
        i = m+1

print(i)
(N,K) = map(int,input().split())
l = input().split()
max = 0
for i in range(N):
    l[i]= int(l[i])
    if max <= l[i]:
        max = l[i]

lb = 0
ub = max

def cut(m):
    k = 0
    for i in range(N):
        k += -((-1*l[i])//m)-1
    return k

while ub - lb > 1:
    if cut((ub+lb)//2)>K:
        lb = (ub+lb)//2
    else:
        ub = (ub+lb)//2

print(ub)
import numpy as np

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

L = np.max(A)

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

print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))
import sys
import math

if sum(A) <= N+K:
  print(1)
  sys.exit()

lt = 1
rt = 10**9

def det(x):
  if sum([math.ceil(A[i]/x) for i in range(N)]) <= N+K:
    return True
  else:
    return False
  
while rt - lt > 1:
  ct = (lt + rt) // 2
  if det(ct):
    rt = ct
  else:
    lt = ct
  
  
print(rt)
n, k = map(int, input().split())
A = list(map(int, input().split()))

max_a = max(A)
min_a = 0

while abs(max_a - min_a) > 1:
    cnt = 0
    target_length = (max_a + min_a)//2
    for a in A:
        cut_num = (a + target_length - 1)//target_length
        cnt += cut_num - 1
    if cnt > k:
        min_a = target_length
    else:
        if target_length - min_a == 1:
            print(target_length)
            exit()
        max_a = target_length

print(max_a)
from  heapq import heappush, heappop, heapify
import math

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

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

l = 0
r = 10 ** 9

def check(m):
    now = 0
    for i in range(N):
        #A[i]-1してるのは、たとえばm=3のときは4,7から回数が増えるため
        now += (A[i]-1) // m
    return now <= K

#差が1になったら終了
while r - l > 1:
    m = (l + r) // 2

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

print(r)
import math
N,K = map(int, input().split())
A_list = list(map(int, input().split()))
lb = 0
ub = 10**9

for i in range(100):
    middle = (lb + ub)/2
    sumi = -N
    for a in A_list:
        sumi += math.ceil(a/middle)

    if sumi <= K:
        ub = middle
    else:
        lb = middle
print(math.ceil(middle))
def main():
    n,k = map(int,input().split())
    A = list(map(int,input().split()))

    left = 0
    right = max(A)

    while abs(right-left)>1:
        cent = (right+left)//2
        
        ct = 0
        for a in A:
            ct+=(a-0.1)//cent
        
        if ct <= k:
            right=cent
        else:
            left=cent
    
    print(right)
main()
from bisect import bisect_left,bisect

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

def is_ok(arg):
  L = bisect(A, arg)
  cnt = 0
  for i in range(L, N):
    p, q = divmod(A[i], arg)
    if q == 0:
      cnt += p-1
    else:
      cnt += p
  return cnt <= K

ng = 0
ok = max(A) + 1

def m_bisect(ng, ok):
  while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
      ok = mid
    else:
      ng = mid
  return ok

print(m_bisect(ng, ok))
n,k=list(map(int,input().split()))
m=list(map(int,input().split()))
import math
def pos(h):
    p=0
    for i in range(n):
        p+=math.ceil(m[i]/h)-1
    return bool(p<=k)
l,r=1,max(m)
while l<r:
    mid=(l+r)//2
    if pos(mid):
        r=mid
    else:
        l=mid+1
print(l)
N, K = map(int, input().split())
*A, = map(int, input().split())


def isOk(m):
    k = 0
    for a in A:
        if a > m:
            k += a//m
            if a % m == 0:
                k -= 1
    if k <= K:
        return True
    else:
        return False


l, r = 10**19, 1
while abs(r-l) > 1:
    m = (l+r)//2
    if isOk(m):
        l = m
    else:
        r = m

if isOk(r):
    print(r)
else:
    print(l)
from math import *
def isok(x):
    res=0
    for i in range(N):
        if A[i]<=x:
            continue
        res+=floor(A[i]/x)
    if res<=K:
        return True
    else:
        return False

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

ng,ok=0,10**10

while(ok-ng>1):
    mid=(ok+ng)//2
    if isok(mid):
        ok=mid#最大をmid以下にするのが可能かどうか
    else:
        ng=mid
print(ok)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = 10**9+1

def ok(x):
    cnt = 0
    for b in a:
        cnt += (b//x)
        if b%x == 0:
            cnt -= 1
    return cnt <= k

while r-l > 1:
    md = (l+r)//2
    if ok(md):
        r = md
    else:
        l = md
print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))

l=0
r=1e9+5

while l+1!=r:
    m = (l+r)//2
    cnt = 0
    for x in a:
        cnt += (x-1)//m
    if cnt <= k:
        r = m
    else:
        l = m
print(int(r))
from math import ceil
N,K = map(int,input().split())
A = list(map(int,input().split()))
lb = 0
ub = max(A)
while True:
    X = (ub+lb)/2
    count = 0
    for i in range(N):
        count += ceil(A[i]/X-1)
    if count > K:
        lb = X
    else:
        ub = X
    if ceil(ub) == ceil(lb):
        print(ceil(ub))
        exit()
def resolve():
    def is_ok(mid):
        cnt = 0
        for a in A:
            cnt += (a-1)//mid
        return cnt <= K

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

    ok = max(A)
    ng = 0
    while ok - ng > 1:
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    print(ok)


if __name__ == "__main__":
    resolve()
n, k, *aa = map(int, open(0).read().split())

imp = 0
psbl = 10**9

while psbl - imp > 1:
    mid = (psbl + imp) // 2
    cost = sum(0--a//mid - 1 for a in aa)
    if cost <= k:
        psbl = mid
    else:
        imp = mid

print(psbl)
n,k=map(int,input().split())
a=list(map(int,input().split()))
ok=max(a)
ng=0
while ok-ng>1:
    mid=(ok+ng)//2
    cnt=0
    for i in range(n):
        num=a[i]
        cnt+=-(-num//mid)-1
    if cnt<=k:
        ok=mid
    else:
        ng=mid
print(ok)