peterverebics/CodeNet_Python_118 huggingface dataset:
# -*- coding: utf-8 -*-

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

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

m = 0
M = 10**9

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

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

hi = 10**18
lo = 0

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)
N, K = map(int, input().split())
A = list(map(int, input().split()))

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

left = 0
right = 10 ** 9
while right - left > 1:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)
from math import ceil
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)
for i in range(100):
    mid = (l + r) / 2
    if c(mid):
        r = mid
    else:
        l = mid
print(ceil(l))
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N,K = MI()
A = LI()

left = 0
right = max(A)  # 可能
while left + 1 < right:
    mid = (left + right)//2
    if sum((A[i]+mid-1)//mid - 1 for i in range(N)) <= K:
        right = mid
    else:
        left = mid
print(right)
n, k, *aa = map(int, open(0).read().split())

imp_length = 0
psbl_length = max(aa)

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

print(psbl_length)
# 2butan renshuu 0812

def f(m):
  cut=0
  for aa in a:
    cut+=(aa-1)//m
    if cut > k:
      return False
  return True

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

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

print(r)
import math
#切る回数を足してK以下ならOK
def ok(l):
    x =sum([math.ceil(a/l) -1 for a in A])
    if x <=K:
        return True
   # else:
    #    return False

# 初期入力
import bisect
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())
A = list(map(int, input().split()))

#2分探索
bottom,top =0,max(A)
while top -bottom >1:
    mid =(top +bottom)//2
    if ok(mid):
        top =mid
    else:
        bottom =mid
print(top)
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):
    if mid == 0:
        return False
    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))
n,k=map(int,input().split())
A=list(map(int,input().split()))

l=0
r=max(A)+1
while r-l>1:
  m=(l+r)//2
  cut=0
  
  for i in range(n):
    cut+=((A[i]+m-1)//m)-1
  if cut>k:
    l=m
  else:
    r=m
print(r)
import math

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

r = max(As)

if K == 0:
  print(r)
  exit()
  
l = 1

while l < r:
  mid = (r + l)//2
  cnt = 0
  for a in As:
    cnt += math.ceil(a/mid) - 1
  if cnt <= K:
    r = mid
  else:
    l = mid + 1
  
print(r)
import math
import heapq
n,k=map(int,input().split())
a=list(map(int,input().split()))
SUM=sum(a)
ans=[]
y=k

for i in range(n):
    x=a[i]*k//SUM
    ans.append([-math.ceil(a[i]/(1+x)),x,i])
    y-=x

heapq.heapify(ans)
#print(y)
#print(ans)
for i in range(y):
    temp=heapq.heappop(ans)
    temp[0]=-math.ceil(a[temp[2]]/(2+temp[1]))
    temp[1]+=1
    heapq.heappush(ans,temp)

temp=heapq.heappop(ans)
print(-temp[0])
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 += (ceil(j/m)-1)
    # 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)
N, K = map(int, input().split())
A = list(map(int, input().split()))


def C(x):
    return sum([max((Ai + x - 1) // x - 1, 0) for Ai in A])


A.sort()
left = 1
right = A[-1]
while left + 1 < right:
    mid = (left + right) // 2
    S = C(mid)
    if S <= K:
        right = mid
    else:
        left = mid
print(left if C(left) <= K else right)
n, k = map(int, input().split())
a = list(map(int, input().split()))

def check(l):
    cnt = 0
    for _ in a:
        cnt += _ // l
        if _ % l != 0:
            cnt += 1
        cnt -= 1
    if cnt <= k: return True
    else : return False

"""
left: ng
right: ok
"""
def binary(ng, ok):
    while ok - ng > 1:
        mid = (ng + ok) // 2
        if check(mid): ok = mid
        else: ng = mid
    return ok

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

# bottom...最小0ずつ切る(不可能な方)、top...最大max(a)ずつ切る（可能な方）
bottom, top = 0, max(a)


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

print(top)
import math

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

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += math.ceil(A[i]/mid-1)

    if count <= k:
        r = mid
    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:
    if x > m:
      need += int(x // m)
  return need <= K

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

lo = 1
hi = int(1e9) + 1

while (lo < hi):
  m = int((lo + hi) // 2)
  if (can(arr, m, K)):
    hi = m
  else:
    lo = m + 1
print(lo)
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 1
r = 1000000000
while l < r:
  m = (l+r)//2
  cnt = 0
  for i in a:
    c = math.ceil(i/m)-1
    cnt += c
  if cnt > k:
    l = m + 1
  else:
    r = m
print(l)
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    left = 0
    right = 10 ** 9
    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()
N, K = map(int, input().split())
*A, = map(int, input().split())

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

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

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


def cut(x):
    cut_count = 0
    for i in range(n):
        cut_count += (a[i]-1)//x
    return cut_count


l = 0
r = 10**9
while r-l > 1:
    mid = (l+r)//2
    if k >= cut(mid):
        r = mid
    else:
        l = mid
print(r)
import math

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

def binary_search(ng=0, ok=max(a)):
    if ok - ng < 2: return ok
    mid = (ok + ng) // 2
    cnt = 0
    for i in a:
        cnt += math.ceil(i / mid) - 1
    if cnt <= k:
        return binary_search(ng, mid)
    else:
        return binary_search(mid, ok)
print(binary_search())
N,K = map(int, input().split())
A = [int(i) for i in input().split()]

"""
切る回数は広義単調減少になる
にぶたん
"""

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

ok = 10 ** 9 + 10
ng = 0
while (ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_dekiru(mid):
        ok = mid
    else:
        ng = mid

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

def isable(n):
    tmp = 0
    for i in range(N):
        tmp += (A[i]-0.5)//n
    if K >= tmp:
        return True
    else:
        return False


left = 0
right = 10**9

while right-left != 1:
    if isable((right+left)//2):
        right=(right+left)//2
    else:
        left=(right+left)//2

print(right)
# coding: utf-8
import numpy as np


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

    l, r = 0, np.max(A)
    while l+1 < r:
        m = (l+r)//2
        if k < np.sum(np.ceil(A/m)-1):
            l = m
        else:
            r = m

    return str(r)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
def judge(A, x, k):
    ans = 0
    for a in A:
        ans += a // x
        if a % x == 0:
            ans -= 1
        if ans > k:
            return False
    return True

n, k = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = max(A)
while r - l != 1:
    x = (r + l) // 2
    if judge(A, x, k):
        r = x
    else:
        l = x
print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))

# 二分探索の為のKey関数
def f(m):
  cut=0
  for aa in a:
    cut+=(aa-1)//m
    if cut > k:
      return False
  return True

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

print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))
def f(x):
    global a,n,k
    if x==0:
        return 10**10
    ret=0
    for i in range(n):
        #print(-((-a[i])//x))
        ret+=(-((-a[i])//x)-1)
    return ret

l,r=0,10**10
while l+1<r:
    x=l+(r-l)//2
    if f(x)<=k:
        r=x
    else:
        l=x

print(r)
#print(f(r))
import math

def resolve():
    _,K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    start = 0
    end = 10**9

    while end - start > 1:
        cnt = 0
        mid = (start + end) // 2
        for a in A:
            cnt += math.ceil(a/mid) - 1
        if cnt <= K:
            end = mid
        else:
            start = mid

    print(end)
    
resolve()
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    
    def check(m):
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        return cnt <= k
        
    l, r = 0, max(a)
    while r-l > 1:
        m = (r+l)//2
        if check(m): r = m
        else: l = m
    print(r)

    


if __name__ == '__main__':
    main()
N, K = map(int, input().split())
l = input().split()
l2 = [int(i) for i in l]

line1, line2 = 0, 10**9

while (line2-line1 > 1):
  x = int((line1 + line2) / 2)
  def f(x):
    now = 0
    for i in range(N):
      now += int((l2[i]-1)/x)
    return now <= K
  if f(x)==True:
    line2 = x
  else:
    line1 = x
    
print(line2)
def check(lis,k,mid):
	for i in lis:
		if(i%mid==0):
			k+=1
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=1,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)
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


n,k = readints()
a = readints()

l = 0
r = 10**10

while r-l>1:
    m = (l+r)//2
    x = [(a[i]-1)//m for i in range(n)]
    if sum(x)<=k:
        r = m
    else:
        l = m

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

def is_ok(X):
    #最大値をX以下にできるか
    cnt = 0
    for a in A:
        cnt += ceil(a/X)-1
    return cnt <= K

def bisearch(high,low):
    while high - low > 1:
        mid = (high+low)//2
        if is_ok(mid):
            high = mid
        else:
            low = mid
    return high

print(bisearch(10**9+1,0))
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
  print(max(A))
  exit()
def f(x):
  cnt=0
  for i in A:
    if i%x==0:
      cnt+=i//x-1
    else:
      cnt+=(i//x)
  if cnt<=K:
    return True
  else:
    return False
ok=1
ng=1000000000
for i in range(50):
  mid=(ok+ng)//2
  if f(mid):
    ng=mid
  else:
    ok=mid
print(ng)
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

ok = 10 ** 9
ng = 0

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

print(ok)
import math

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

def cal(lis,x):
    an = 0
    for i in range(len(lis)):
        an += (math.ceil(lis[i] / x) - 1)
        
    return an

left = 0
right = 10**9

for i in range(100):
    m = (left + right) / 2
    
    b = cal(a,m)
    
    if b > k:
        left = m
    else:
        right = m
        
print(math.ceil(m))
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
        if tmp%num==0:
            ret-=1
    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))
#print(min(min(a),r))
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)-1
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)
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)
n,k=map(int,input().split())
*a,=map(int,input().split())
l,r=0,10**9
while r-l>1:
    m=(l+r)//2
    t=0
    for x in a:
        if x<=m:
            continue
        t+=(x+m-1)//m-1
    if t<=k:
        r=m
    else:
        l=m
print(r)
n, k, *a = map(int, open(0).read().split())


def c(x):
    res = 0
    for b in a:
        # bを最大がxになるように、できるだけ少ない回数で
        # だいたいb/x等分？
        res += 0 - - b // x - 1
    return res <= k


ng = 0
ok = 10 ** 10
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if c(mid):
        ok = mid
    else:
        ng = mid
print(ok)
n,k = map(int,input().split())
a = list(map(int,input().split()))

ng = 0
ok = 10**9

while ng < ok-1:
    mid = (ng+ok)//2
    
    count = sum((ai-1)//mid for ai in a)
    if count<=k: ok = mid
    else: ng = mid

print(ok)
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=0,max(a)
while 1<r-l:
 m=(l+r)//2;c=0
 for i in a:c+=math.ceil(i/m)-1
 if c>k:l=m
 else:r=m
print(r)
n,k,*a=map(int,open(0).read().split())
l,r=0,10**9
while~l+r:
 x=l+r>>1
 if-sum(-b//x+1for b in a)>k:l=x
 else:r=x
print(r)
N, K = map(int, input().split())
A = list(map(int, input().split()))

# にぶたん: 答えをx以下にできるか？
ok, ng = 10 ** 9 + 1, 0
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    cnt = 0

    for a in A:
        if a <= x:
            continue

        cnt += a // x
        if cnt > K:
            ng = x
            break
    else:
        ok = x

print(ok)
import math
def check(l, x, k):
  c = 0
  for a in l:
    c += math.ceil(a/x)-1
  if c <= k:
    return True
  else:
    return False

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

ok = max(a)
ng = 0
while abs(ok-ng)>1:
  mid = (ok+ng)//2
  if check(a, mid, k):
    ok = mid
  else:
    ng = mid

print(ok)
n,k,*a=map(int,open(l:=0).read().split())
r=10**9
while~l+r:x=l+r>>1;l,r,*_=(l,x,r)[-sum(-b//x+1for b in a)>k::]
print(r)
n, k = map(int, input().split())
a = list(map(int, input().split()))

hi = 10 ** 9
lo = 0
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)
N, K = map(int, input().split())
A = list(map(int, input().split()))
ok = 10**9
ng = 0
while ng+1 < ok:
    tmp = (ok+ng)//2
    k = 0
    for a in A:
        if a%tmp == 0:
            k += a//tmp -1
        else:
            k += a//tmp
    if k <= K:
        ok = tmp
    else:
        ng = tmp
print(ok)
n,k=map(int,input().split())
a=list(map(int,input().split()))
ng=0
ok=max(a)+1
while ok-ng>1:
    mid=(ng+ok)//2
    count=0
    for i in range(n):
        if a[i]%mid==0:
            count+=((a[i]//mid)-1)
        else:
            count+=(a[i]//mid)
    if count>k:
        ng=mid
    else:
        ok=mid
print(ok)
import sys
input = sys.stdin.readline


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

    l = 0
    r = max(A)

    while l+1 < r:
        count = 0
        length = (l+r) // 2
        for a in A:
            count += (a-1) // length

        if count <= k:
            r = length
        else:
            l = length

    print(r)


if __name__ == "__main__":
    main()
def check(List,mid):
    tmp=0
    for l in List:
        tmp+=(-(-l//mid)-1)
    return tmp

n,k=map(int,input().split())
a=list(map(int,input().split()))
lo=0
hi=max(a)+1

while hi - lo > 1:
    mid=(lo+hi)//2
    if check(a,mid)<=k:
        hi=mid
    else:
        lo=mid

print(hi)
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
arr=list(map(int,input().split()))
l=0
r=max(arr)+1
while r-l!=1:
    persuit=(r+l)//2
    cnt=0
    for val in arr:
        if val<=persuit:
            continue
        if val%persuit==0:
            cnt+=val//persuit-1
        else:
            cnt+=val//persuit
    if cnt<=k:
        r=persuit
    else:
        l=persuit
print(r)
def is_good(mid, key):
    return sum((a + mid - 1) // mid for a in A) - N <= key


def binary_search(bad, good, key):
    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(0, 1_000_000_000, K))
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
from math import ceil
def main(N, K, A):
    def cut_times(longest):
        return sum(a // longest for a in A if a > longest)
    under = 0
    r = 10**9
    for i in range(100):
        m = (under + r) / 2
        if cut_times(m) > K: under = m
        else: r = m
    print(ceil(r - 10**-10))

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

l = 1
r = 10**9 + 1

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

print(l)
from math import ceil
n, k = map(int, input().split())
a = list(map(int, input().split()))
ok = 10**10
ng = 0


def judge(x):
    cnt = 0
    for aa in a:
        cnt += (x + aa - 1) // x - 1
        # print(cnt)
    return cnt <= k


# print(judge(4))
# print(judge(5))
# print(judge(3))

while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if judge(mid):
        ok = mid
    else:
        ng = mid
print(ok)
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,k,*a = [int(i) for i in read().split()]



def check(x,k):
    #k回切って最短を長さ x 以下にできるならOK 
    v = 0
    for ai in a:
        v += (ai-1)//x
    return v <= k


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

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

def check(x):
  count = 0
  for Ai in A:
    count += (Ai - 1)//x
  
  return count <= K

#めぐる式そのまま
ok = 10**9
ng = 0
while ok-ng > 1:
  mid = (ok + ng)//2
  if check(mid):
    ok = mid
  else:
    ng = mid

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

def check(x):
  c = 0
  for i in range(n):
    c += a[i]//x
    if a[i]%x == 0:
      c -= 1
  if c <= k:
    return True
  else:
    return False

mx = max(a)
mn = 0
ans = [mx]
while mn <= mx:
  m = (mx+mn)//2
  if m == 0:
    if check(1):
      ans.append(1)
    break
  if check(m):
    mx = m - 1
    ans.append(m)
  else:
    mn = m + 1
print (min(ans))
I=lambda:list(map(int,input().split()))
n,k=I()
l=I()
low=1
high=max(l)
while low<high:
	mid=(low+high)//2
	temp=0
	for i in l:
		temp+=(i//mid)-(i%mid==0)
	if temp>k:
		low=mid+1
	else:
		high=mid
print(low)
n, k = map(int, input().split())
a = list(map(int, input().split()))

left = 0
right = max(a)

while right - left > 1:
    mid = (right + left) // 2
    tmp = 0
    for i in a:
        tmp += (i - 1) // mid
    
    if tmp <= k:
        right = mid
    else:
        left = mid
        
print(right)
from math import *

def trycut(val):
	if val == 0 : return float('inf')
	ret = 0
	for i in range(n):
		ret += (a[i]+val-1)//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)
	if cut <= k:
		high = mid-1
		ans = mid
	else:
		low =  mid+1
print(ans)
import math

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

m = 1
M = max(A)

while(M-m>0):
    mm = 0

    mid = (M+m)//2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid+1
    else:
        M = mid

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

leq,high = 0,1e10
while high-leq > 1:
  l = int((leq+high)/2)
  cnt = 0
  for ai in a:
    cnt += int((ai-1)/l)
  if cnt>k:
    leq = l
  else:
    high = l

print(high)
import math

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

l = 0
r = max(list)

while r - l > 1:
  count = 0
  x = (r + l)//2

  for i in range(len(list)):
    if x >= list[i]:
      continue
    count += math.ceil(list[i]/x) - 1

  if count <= k:
    r = x
  else:
    l = x

print(r)
import math

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

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

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

if K == 0:  print(max(A))
else:
    left = max(A)
    right = 0
    ret = binary_search(right, left)
    print(ret)
n, k = map(int, input().split())
A = list(map(int, input().strip().split()))

b = 0
e = max(A)
L = e // 2
while e - b > 1:
    L = (e + b) // 2
    m = sum(list(map(lambda x: (x - 1) // L, A)))
    if m <= k:
        e = L
    else:
        b = L
print(e)
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
try:
  up, lo = ceil(sum(A) / K), 0
  while up - lo > 1:
    mid = (up+lo) // 2
    cnt = 0
    for a in A:
      cnt += ceil(a / mid)-1
    if cnt > K:
      lo = mid
    else:
      up = mid
  print(up)
except ZeroDivisionError:
  print(max(A))