peterverebics/CodeNet_Python_118 huggingface dataset:
N,K = map(int,input().split())
A = list(map(int,input().split()))
ok = 1000000000
ng = 0

while ok-ng>1:
    count = 0
    mid = (ok+ng)//2
    for a in A:
        if a%mid==0:
            count += -1+a//mid
        else:
            count += a//mid

    if count <= K:
        ok = mid
    else:
        ng = mid
print(ok)
N, K = map(int, input().split())
A = list(map(int, input().split()))
left, right = 0, max(A)
while right - left != 1:
    mid = (left + right) // 2
    tmp = 0
    for i in A:
        tmp += i // mid - 1 if i % mid == 0 else i // mid

    if tmp > K:
        left = mid
    else:
        right = mid

print(right)
#!/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) > 3e-6:
    m = (ok + ng) / 2
    if f(m) > k:
        ok = m
    else:
        ng = m
print(ceil(ok))
N,K=map(int,input().split())
l=list(map(int,input().split()))
import math
def f(n):
   A=0
   for i in l:
      A+=math.ceil(i/n)-1
   return A<=K
def bis(ng,ok):
   while abs(ok-ng)>1:
      mid=(ok+ng)//2
      if f(mid):
         ok=mid
      else:
         ng=mid
   return ok
print(bis(0,max(l)))
from math import ceil
N, K = map(int,input().split())
A = list(map(int,input().split()))
def chk(L):
    cnt = 0
    for i in range(N):
        cnt += ceil(A[i]/L)-1
    return cnt <= K
l, r = 1, max(A)
while l <= r:
    m = (l+r)//2
    if chk(m):
        r = m-1
    else:
        l = m+1
print(min([x for x in [m-1,m,m+1] if x > 0 and chk(x)]))
n, k = map(int, input().split())
a = list(map(int, input().split()))

# binary search
left = 1
right = 10 ** 9

while left < right:
    center = (left + right) // 2

    total = 0
    for i in a:
        if i % center == 0:
            i -= 1
        total += i//center
    
    if total > k:
        left = center + 1
    else:
        right = center

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

l = 1
r = 10**9 + 1

import math
while l < r:
    mid = (l + r) // 2
    counter = 0
    for i in range(N):
        if A[i] > mid:
            counter += math.ceil(A[i]/mid) - 1
    if counter <= K:
        r = mid
    else:
        l = mid + 1

print(l)
import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
A=[int(i) for i in input().split()]

l,r=0,max(A)
cur=0
while cur<100:
	mid=(l+r)/2
	ct=0
	for a in A:
		if a<=mid:
			continue
		else:
			t=int(a/mid)
			if t*mid==a:
				t-=1
		ct+=t
	if ct<=k:
		r=mid
	else:
		l=mid
	cur+=1

ans=int(r)
if ans==r:
	print(ans)
else:
	print(ans+1)
from math import ceil
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = 0
r = max(a)
def f(ln, x):
    return ceil(ln/x)-1
while r-l > 1:
    m = (r+l)//2
    cnt = 0
    for i in range(n):
        cnt += f(a[i],m)
    if cnt > k:
        l = m
    else:
        r = m
print(r)
# にぶたん　二分探索
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
  cnt = 0
  for a in A:
    cnt += (a - 1) // mid
  if cnt <= k:
    ok = mid
  else:
    ng = mid

print(ok)
def isok(arg):
    count = 0
    for i in range(N):
        count += -(-A[i]//arg)-1
    if count <= K:
        return True
    else:
        return False

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

N,K = map(int,input().split())
A = list(map(int,input().split()))
print(bisect(0,10**9))
n, k = map(int, input().split())
A = [*map(int, input().split())]
A.sort(reverse=True)
ng, ok = 0, 1<<30
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A:
        d = (a - 1) // m
        if d == 0: break
        c += d
    if c <= k: ok = m
    else: ng = m
print(ok)
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

l = 0
r = 1000000000

def judge(m):
    k = 0
    for i in range(N):
        if A[i]%m==0:
            k+=A[i]//m-1
        else:
            k+=A[i]//m
    return k<=K

while r-l>1:
    if judge((l+r)//2):
        r = (l+r)//2
    else:
        l = (l+r)//2
print(r)
import math
n,k = map(int,input().split())
A = list(map(int,input().split()))

low = 1
high = max(A)

while low != high:
    mid = (low + high)// 2
    cnt = 0
    for i in A:
        cnt += math.ceil(i/mid) - 1
    if cnt > k :
        low = mid + 1
    else:
        high = mid

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

print(math.ceil(maxVal))
n,k,*a=map(int,open(l:=0).read().split())
r=10**9
while~l+r:l,r,*_=(l,x:=l+r>>1,r)[-sum(-b//x+1for b in a)>k:]
print(r)
from sys import stdin
rs = stdin.readline
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    N, K = ril()
    A = ril()
    l = 1
    r = 1000000000
    while l < r:
        m = (l + r) // 2
        k = 0
        for a in A:
            k += (a - 1) // m
        if k <= K:
            r = m
        else:
            l = m + 1
    print(r)

if __name__ == '__main__':
    main()
#!/usr/bin python3
# -*- coding: utf-8 -*-

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

def cnt(x):
  ret = 0
  for ai in a:
    ret += (ai+(x-1))//x - 1
  return ret

ok, ng = a[-1], 0
while ok - ng > 1:
  nw = (ok + ng) // 2
  if cnt(nw)<=k:
    ok = nw
  else:
    ng = nw

print(ok)
def main():
    log_no, cut_max = [int(x) for x in input().split()]
    logs = [int(x) for x in input().split()]
    bin_l, bin_r = 0, 10 ** 9
    while bin_r - bin_l > 1:
        bin_mid = (bin_l + bin_r) // 2
        cut_count = sum((log - 1) // bin_mid for log in logs)
        if cut_count <= cut_max:
            bin_r = bin_mid
        else:
            bin_l = bin_mid
    print(bin_r)


if __name__ == '__main__':
    main()
N,K=map(int,input().split())
*A,=map(int,input().split())

def C(x):
  return sum([(A[i]-.5)//x for i in range(N)]) <= K
  
def binary_search2(func, n_min, n_max):
    left,right=n_min,n_max
    while right-left>1:
        middle = (left+right)//2
        y_middle = func(middle)
        if y_middle: right=middle
        else: left=middle

    return right
  
print(binary_search2(C, 0, max(A)+1))
n,k = map(int, input().split())
a = sorted(list(map(int,input().split())), reverse=True)

l = 1
h = a[0]
while l != h:
    m = (l + h) // 2
    cut = 0
    for x in a:
        cut += x // m + (x % m != 0) - 1
    if cut <= k:
        h = m
    else:
        l = m + 1

print(l)
N,K=map(int,input().split())
A=list(map(int,input().split()))
L=0;R=10**9
while(R-L>1):
	M=L+R>>1;C=0
	for i in A:C+=(i-1)//M
	if C<=K:R=M
	else:L=M
print(R)
n, k = map(int, input().split())
a = tuple(map(int, input().split()))
ok = 10**9
ng = 0
while abs(ng-ok) > 1:
    mid = (ok + ng) // 2
    cnt = 0
    for i in a:
        cnt += (i+mid-1)//mid-1
    if cnt <= k:
        ok = mid
    else:
        ng = mid
print(ok)
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(np.ceil(a / mid) - 1) <= k:
        ok = mid
    else:
        ng = mid
print(ok)
N, K = map(int, input().split())
A = list(map(int, input().split()))

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

a = 0
b = 2**32
while b>0:
  if f(a+b)>K:
    a += b
  b //= 2
print(a+1)
def resolve():
    import math
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    r = max(a)
    l = 0
    def cuttimes(p, cutter):
        return math.ceil(p/cutter)-1

    while r-l > 1:
        mid = (r+l)//2
        cut = 0
        for i in range(n):
            cut += cuttimes(a[i], mid)

        if cut <= k:
            r = mid
        else:
            l = mid
    print(r)

resolve()
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
M = max(A)
m = 1
mid = (M+1)//2
while m<M:
  n = 0
  for a in A:
    n += -(-a//mid)-1
    if n > K:
      m = mid+1
      break
  else:
    M = mid
  mid = (M+m)//2
print(mid)
import math, sys

N,K = map(int,input().split())
A = [int(x) for x in input().split()]
lower = 0
upper = 10**10

while upper - lower > 0.1:
    cuts = 0
    trial = (lower + upper) / 2
    for i in A:
        cuts += math.ceil(i/trial)-1
    if cuts <= K:
        upper = trial
    else:
        lower = trial
ans = math.ceil(lower)
if ans == 0:
    print(1)
    sys.exit()
cuts = 0
for i in A:
    cuts += math.ceil(i / ans) - 1
if cuts <= K: print(ans)
else: print(ans + 1)
from heapq import *
N,K=map(int,input().split())
A=list(map(int,input().split()))
Q=[]
heapify(Q)
for i in range(N):
  heappush(Q,(-A[i],1))
x=0
if K==0:
  print(max(A))
  exit()
L,R,M=1,max(A),0
while R!=L:
  M=(L+R)//2
  x=0
  for i in range(N):
    x+=(A[i]-1)//M
  if x>K:
    L=max(L+1,M)
  else:
    R=M
print(L)
def possible(l, a, k):
    for x in a:
        k -= x//l
        if x%l==0:
            k += 1
    return k>=0

n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
    mid = (mini+maxi)//2
    if possible(mid, a, k):
        maxi = mid
    else:
        mini = mid + 1
print(mini)
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))

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

suki = 1000000000
kirai = 0
while suki-kirai>1:
	targ = (suki+kirai)//2
	cnt = 0
	mode = 1
	for i in range(n):
		cnt += -(-a[i]//targ)-1
		if cnt > k:
			mode = 0
			break
	if mode:
		suki = targ
	else:
		kirai = targ

print(math.ceil(suki))
import math

def cut_num(length,max_length):
    return math.ceil(length/max_length)-1

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

l = 1
r = 10**9

while l<r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        count += cut_num(a[i],mid)
    if count > k:
        l = mid+1
    else:
        r = mid
print(l)
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = 10**9
while (r-l>1):
    x = (r+l)//2
    now = 0
    for a in A:
        now += (a-1)//x
    if now <= K:
        r = x
    else:
        l = x
print(r)
n, k = map(int, input().split())
a = list(map(int, input().split()))


def is_ok(l):
    cnt = 0
    for L in a:
        cnt += L // l - 1
        if L % l != 0:
            cnt += 1
    return cnt <= 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(a)))
N, K, *A = map(int, open(0).read().split())

def is_ok(x):
    cnt = 0
    for a in A:
        cnt += -(-a // x) - 1
    return cnt <= K

ng, ok = 0, 10 ** 10
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid

print(ok)
n,k=map(int, input().split())
*a,=map(int, input().split())
mx=max(a)
mn=10**(-9)
from math import ceil
while mx-mn>10**(-5):
    md=(mx+mn)/2
    cnt=0
    for ai in a:
        cnt+=ceil(ai/md)-1
    if cnt<=k:
        mx=md
    else:
        mn=md
print(ceil(mn))
N, K = map(int, input().split())
tree = list(map(int, input().split()))
left = 0
right = 2*(10**9)
treeLen = len(tree)

while right - left > 1:
    cnt = 0
    mid = (right + left) // 2
    for i in range(treeLen):
        cnt += tree[i] // mid
        if tree[i] % mid == 0:
            cnt -= 1  # ちょうどに切れるときは切り口が1減る
    if K >= cnt:
        right = mid
    else:
        left = mid

print(right)
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [x * 2 for x in a]
result = max(a)
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
    counter = sum([(x - 1) // med for x in a])
    if counter <= k:
        result = med
        right = med - 1
    else:
        left = med + 1
    med = left + (right - left) // 2
print((result + 1) // 2)
def is_ok(arg):
    cnt = 0 
    for i in range(N):
        cnt += -(-A[i]//arg) - 1
    return K < cnt

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(max(A)+1, 0)+1)
import math

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

def is_ok(x,a,k):
    b = 0
    for ai in a:
        b += math.ceil(ai/x)
        b -= 1
    if b <= k:
        return True

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


print(meguru_bisect(0,max(a)))
n, k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()

ok = a[-1]
ng = 0
while abs(ok - ng)>1:
    X = (ok + ng)//2
    
    cnt = 0
    for i in range(n):
        temp = a[-(i + 1)]
        if temp <= X:break
        temp_cnt = (temp + X - 1)//X - 1
        cnt += temp_cnt
    
    if cnt <= k:ok = X
    else:ng = X
    
print(ok)
import math

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

start = 0
end = max(a)
middle = (end+start) // 2

while end - start > 1:
    count = 0
    for i in range(n):
        if a[i] > middle:
            count += math.ceil(a[i] / middle) - 1
            
    if count <= k:
        end = middle
    else:
        start = middle
        
    middle = (end+start) // 2
    
print(end)
n,k=map(int,input().split())
arr=list(map(int,input().split()))
m=max(arr)
if(k==0):
	print(m)
else:
	low=1
	high=m
	while(low<=high):
		mid=low+(high-low)//2
		if(mid==1):
			print(mid)
			break
		count=0
		count2=0
		for i in range(n):
			count+=(arr[i]-1)//mid
			count2+=(arr[i]-1)//(mid-1)
		if(count<=k and count2>k):
			print(mid)
			break
		elif(count<k or (count<=k and count2<=k+1)):
			high=mid-1
		else:
			low=mid+1
from math import ceil
n, k, *A = map(int, open(0).read().split())
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
c = k - sum(int(a/t)-1 for a in A)
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[-c-1])
from sys import stdin
import numpy as np
n, k = map(int, stdin.buffer.readline().split())
a = np.array(stdin.buffer.read().split(), dtype=np.int64)

ng = 0
ok = 10 ** 9 + 1
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if np.sum(np.ceil(a / mid) - 1) <= k:
        ok = mid
    else:
        ng = mid
print(ok)
from math import ceil


def check(x):
    # 全てを長さx以下にするために必要な回数
    cnt = 0
    for a in A:
        # 切る回数は-1した回数。a=20 x=4 20/4=5 だが切る箇所は4。
        cnt += ceil(a/x)-1
    return cnt <= K


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

left = 0
right = max(A)
while left < right-1:
    mid = (left+right)//2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)
import sys
input = sys.stdin.readline

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


l = 0
r = 2*10**9

while r - l > 1:
    m = (l+r)//2
    count = 0
    for a in A:
        count += (a+m-1)//m-1
    if count <= K:
        r = m
    else:
        l = m
    
print(r)
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 = 0
  high = 10**9
  mid = (low+high)//2
  while high>low+1:
    if check(N,mid,A,K):
      high = mid
    else:
      low = mid
    mid = (low+high)//2
  ans = high
  return ans
print(solve())
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
    while left < right:
        mid = (left + right) // 2
        if ok(mid):
            right = mid
        else:
            left = mid + 1
    print(left)


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

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

suki = 1000000000
kirai = 0
while int(suki) != int(kirai):
	targ = (suki+kirai)/2
	cnt = 0
	mode = 1
	for i in range(n):
		cnt += (a[i]-1)//targ
		if cnt > k:
			mode = 0
			break
	if mode:
		suki = targ
	else:
		kirai = targ

print(math.ceil(suki))
n,k=map(int,input().split())
a=list(map(int,input().split()))
def case(L):
    result=0
    for x in a:
        result+=(x-1)//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

def f(n):
    x = 0
    for ai in a:
        x += math.ceil(ai/n)-1
    return x <= k

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

n,k = map(int,input().split())
a = list(map(int,input().split()))
print(solve(0,max(a)))
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
ng=0
ok=10**9
while ok-ng >1:
  l = (ng+ok)//2
  kt=0
  for i in range(n):
    kt += a[i]//l - (0 if a[i]%l else 1)
  if kt <= k:
    ok = l
  else:
    ng = l
print(ok)
from heapq import heappush, heappop, heapify
import math
def check(a,mid,k):
	cnt = 0
	for x in a:
		cur_cnt = (x+mid-1)//mid - 1
		cnt+=cur_cnt
		if cnt > k:
			return False
	return True

def solve():
	n , k= map(int, input().strip().split())
	a= [int(x) for x in input().strip().split()]
	l = 0
	r = 10**9+20
	while r-l > 1:
		mid = (r+l)//2
		if check(a,mid,k):
			r = mid
		else:
			l = mid
	return l+1
 
print(solve())
def check(x):
    ret = 0
    for e in a:
        ret += max((e - 1) // x, 0)

    return ret <= k


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

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

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

a.sort(reverse=True)
idx = 0
result = 0

bottom, top = 0, max(a)

while top - bottom > 1:
    mid = (top + bottom) // 2
    cnt = 0
    for i in range(n):
        cnt += a[i] // mid
        if a[i] % mid == 0:
            cnt -= 1
    if cnt <= k:
        top = mid
    else:
        bottom = mid

print(top)
def is_ok(x):
    cnt = 0
    for a in A:
        cnt += -(-a//x)-1
    if cnt <= k:
        return True
    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,10**9+1))
N, K = map(int,input().split())
A = list(map(int, input().split()))

OK = 10**9
NG = 0

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)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = 10**9 + 1
ref = 0
ans = 10**9

while r - l > 1:
    now = (l + r)//2
    for i in a:
        ref += 0 - -i//now - 1
        if ref > k:
            ref = 0
            l = now
            break
    else:
        ans = now
        ref = 0
        r = now
print(ans)
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()))

l=0
r=10**9

def check(x):
    now = 0
    for i in range(n):
        now += (a[i] - 1 )// x
    return now <= k

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

print(r)
def is_ok(X):
    cnt = 0
    for a in A:
        cnt += (a-1)//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))
N, K = map(int, input().split())
A = list(map(int, input().split()))

# 丸太がすべてxの長さ以下になる回数を出し、それがＫ回以下か判定する
def f(x):
    now = 0
    for i in range(N):
        now += (A[i]-1)//x
    return now <= K

l = 0
r = 10**9

while r-l > 1:
    mid = (r+l)//2
    if f(mid):
        r = mid
    else:
        l = mid
print(r)
import math,sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=0
r=10**9+2
while math.ceil(l)<math.floor(r):
  tr=(l+r)/2
  temp=0
  for i in range(n):
    temp+=math.ceil(a[i]/tr)-1
  if temp<=k:
    r=tr
  else:
    l=tr
tr=math.ceil(l)
if tr==0:
  print(1)
  sys.exit()
temp=0
for i in range(n):
  temp+=a[i]//tr
  if a[i]%tr==0:
    temp-=1
if temp<=k:
  print(tr)
else:
  print(tr+1)
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 abs(r - l) > 1:
    mid = (l + r) // 2
    if cal(mid):
        r = mid
    else:
        l = mid
print(r)
N,K = map(int,input().split())
A = list(map(int,input().split()))

l = 0
r = max(A)

while r-l != 1:

    m = (l+r)//2

    now = 0
    for i in range(N):
        if A[i] % m == 0:
            now += A[i] // m -1
        else:
            now += A[i] // m

    if now > K:
        l = m
    else:
        r = m

print (r)
N, M = input().strip().split()
n, k = [int(N), int(M)]
a = list(map(int, input().strip().split()))
le = 0
ri = 10000000000
while ri - le > 1:
    mid = (le + ri) // 2
    num = 0
    for i in a:
        num += (i-1) // mid
    if num <= k:
        ri = mid
    else:
        le = mid
print(ri)
N, K = map(int, input().split())
A = list(map(int, input().split()))

ng = 0
ok = max(A)

while ok - ng > 1:
    cnt = 0
    l = (ok + ng) // 2
    for a in A:
        cnt += (a // l) + (a % l != 0) - 1

    if cnt <= K:
        ok = l
    else:
        ng = l
print(ok)
n,k=map(int,input().split())
a=[int(j) for j in input().split()]
a.sort(reverse=True)
def f(x):
    c=0
    for i in a:
        if i<x:
            break
        c+=-(-i//x)-1
        if c>k:
            return False
    return True
left=0
right=a[0]
while right-left>1:
    mid=(left+right)//2
    if f(mid):
        right=mid
    else:
        left=mid
print(right)
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K == 0:
    print(max(A))
    quit()

def check(x):
    count = 0
    for a in A:
        count += -(-a // x) - 1
        if count > K:
            return False
    return True


left = 0 # False
right = 10**10 # True
while left + 1 < right:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid

print(right)
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10**9
while r - l > 1:
  m = (l + r) // 2
  s = 0
  for x in a:
    s += (x - 1) // m
  if s <= k:
    r = m
  else:
    l = m
print(r)