peterverebics/CodeNet_Python_118 huggingface dataset:
n, k = map(int, input().split())
*arr, = map(int, input().split())

lo = 1
hi = max(arr) + 1

def can(arr, rem_length, k):
    cnt = 0
    for v in arr:
        cnt += (v - 1) // rem_length
    if cnt <= k:
        return True
    return False


while lo < hi:
    mid = (lo + hi) // 2
    if can(arr, mid, k):
        hi = mid
    else:
        lo = mid + 1


print(lo)
import sys , math

N,K=list(map(int, input().split()))
Ws=list(map(int, input().split()))
Ws.sort(reverse=True)

l=0
r=10**9

def check (m):
    now=0
    for i in range(N):
        now += (Ws[i] - 1) // m
    return now <= K

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()))
r=max(A)
l=0
while l+1<r:
    mid=(l+r)//2
    if sum([(a-1)//mid for a in A])>k:
        l=mid
    else:
        r=mid

print(r)
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)

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)
def binary_search(key):
    '''
    条件を満たす最小のindexを求める
    '''
    right = 10 ** 9 + 1
    left = 0
    while right - left > 1:
        mid = (right + left) // 2

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

        if cnt <= key:
            right = mid
        else:
            left = mid
    
    return right


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

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

ok=max(alst)
ng=0

while abs(ok-ng)>1:
    cen=(ok+ng)//2

    cnt=0

    for a in alst:
        cnt+=(a+cen-1)//cen-1

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

print(ok)
import sys
input = sys.stdin.buffer.readline

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


ok = 10**10
ng = 0

while ok-ng > 1:
    m = (ok+ng)//2
    c = 0
    for e in a:
        if e%m == 0:
            c += e//m - 1
        else:
            c += e//m

    if c <= k:
        ok = m
    else:
        ng = m
print(ok)
n,k = map(int,input().split())
L = list(map(int,input().split()))

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

lower = 0
upper = max(L)

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

print(upper)
import math

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


min_A = 0
max_A = 10**10

while( max_A - min_A > 1):
  now = (min_A + max_A) // 2
  temp = 0
  for i in A:
    if i > now:
      temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now

print(int(min_A) + 1)
N, K = map(int, input().split())
logs = list(map(int, input().split()))

l, r = 0, int(1e9)

def count_cut(log, size):
    return (log - 1) // size

while r - l > 1:
    pivot = (r + l) // 2
    count = sum(count_cut(log, pivot) for log in logs)

    if K < count:
        l = pivot
    elif count <= K:
        r = pivot

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

max_l = 10**9
min_l = 0
while max_l - min_l != 1:
    count = 0
    mean = (max_l+min_l)//2
    for i in range(n):
        count += -(-a[i]//mean)-1
    if count <= k:
        max_l = mean
    else:
        min_l = mean
print(max_l)
n, k = map(int, input().split())
*A, = map(int, input().split())
a, b = 0, 10**9
while b - a > 1:
    x = (a + b) // 2
    cut = 0
    for i in range(n):
        cut += -(-A[i] // x) - 1
    if cut <= k:
        b = x
    else:
        a = x
print(b)
# coding: utf-8

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

    l, r = 0, max(A)
    while l+1 < r:
        m = (l+r)//2
        cnt = 0
        for a in A:
            cnt += -(-a//m)-1

        if k < cnt:
            l = m
        else:
            r = m

    return str(r)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
n, k=map(int, input().split())
a=list(map(int, input().split()))

right=max(a)
left=0
def logs(a, n, x):
    sm=0
    for i in range(n):
        sm+=(a[i]-1)//x
    if sm<=k:
        return True
    else:
        return False

def binary_search(left, right):
    while right - left > 1:
        center=(left+right)//2
        if logs(a, n, center):
            right=center
        else:
            left=center
    
    return right
        
print(binary_search(left, right))
import sys
import numpy as np
import math
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))
n,k = Mi()
a = np.array(sys.stdin.readline().split(), np.int64)
sa = np.sum(a)
mina = sa//(n+k)
maxa = np.max(a)
while maxa > mina+1:
  mid = (mina+maxa)//2
  div = np.sum(np.ceil(a/mid-1))
  #print(mina,maxa,div)
  if div > k:
    mina = mid
  else:
    maxa = mid
  
print(maxa)
from heapq import heappush, heappop, heapify

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


def check(x):
    # 最長の丸太をx以下にできるか
    # 任意の丸太をx以下にできるか
    cnt = sum([(ai - 1) // x for ai in a])
    return cnt <= k


lb = 0  # False
ub = max(a)  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    # print(mid, check(mid))
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)
import math
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)
from sys import stdin
import numpy as np
n, k = map(int, stdin.buffer.readline().split())
a = np.fromstring(stdin.buffer.read(), dtype=np.int64, sep=' ')

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)
import math
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

# https://qiita.com/hamko/items/794a92c456164dcc04ad
def binary_search(a, k):
    ng = 0 # left:絶対に達成不可能なもの
    ok = max(a) # right:絶対に達成可能なもの
    while (ok - ng > 1):
        mid = (ng + ok) // 2
        if sum([math.ceil(a[i]/mid)-1 for i in range(n)]) <= k:
            ok = mid
        else:
            ng = mid
    return ok
print(binary_search(a, k))
import sys

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

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

def check(t):
    if t == 0:
        return False
    ans = 0
    for ai in a:
        if ai > t:
            ans += ai // t
    return ans <= k

l = 0
r = 10 ** 9 + 1

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

if check(l):
    print(l)
else:
    print(r)
N, K = map(int, input().split())
A = list(map(int, input().split()))

l = 1
r = max(A)
while l != r:
    mid = (r + l) // 2
    count = 0
    for log in A:
        count += (log - 1) // mid
    if count <= K:
        r = mid
    else:
        l = mid + 1

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

def f(n):
    cnt = 0
    for a in a_i:
        cnt += (a - 1) // n
    if cnt > k: return False
    else: return True

l, r = 0, max(a_i)
while True:
    if r - l <= 1: break
    val = (l + r) // 2
    if f(val) == True: r = val
    else: l = val
print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=10**9,0
while l-r>1:
    t=(l+r)//2
    if sum((i-1)//t for i in a)>k:
        r=t
    else:
        l=t
print(l)
import sys
input=sys.stdin.readline

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

l=1
r=10**9
import math
for i in range(100):
    temp=0
    m=(r+l)/2
    for j in a:
        temp+=j//m
    if temp<=k:
        r=m
    else:
        l=m

print(math.ceil(m))
def abc174_e():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    if k == 0: return max(A)

    lower, upper = 0, 10**9
    while upper - lower > 1:
        x = (upper + lower) // 2
        cnt = 0
        for a in A:
            cnt += a // x
            if a % x == 0: cnt -= 1
            if cnt > k: break
        if cnt > k: lower = x
        else: upper = x
    return upper

if __name__ == '__main__':
    print(abc174_e())
import math

def main():
    _, k = map(int, input().split())
    arr = list(map(int, input().split()))
    l, r = 1, 1000000000
    while l < r:
        m = (l + r) // 2
        cnt = 0
        for val in arr:
            cnt += math.ceil(val / m) - 1
        if cnt > k:
            l = m + 1
        else:
            r = m
    print(l)
  
if __name__ == '__main__':
    main()
N,K=map(int,input().split())
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  if x==0:
    return float("inf")
  
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
U = max(A)+1
L = 0


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


while U-L > 1:
    x = (U+L+1)//2
    if can(x, K):
        U = x
    else:
        L = x

print(U)
n, k = map(int, input().split())
list_A = list(map(int, input().split()))
l, r = 0, max(list_A)

while l + 1 < r:
    m, cnt = (r + l) // 2, 0

    for a in list_A:
        cnt += (a-1)//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 = 10 ** 9 + 1

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

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

print(ok)
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))

def check(x):
  k = 0
  for i in range(N):
    if a[i] > x:
      k += a[i] // x
  return k <= K

ok = 10 ** 9 + 1
ng = 0
while ok - ng > 1:
  m = (ok + ng) // 2
  if check(m): ok = m
  else: ng = m
print(ok)
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 0
R = max(A)
while R-L > 0.001:
    X = (L+R)/2
    m = 0
    for i in range(N):
        c = A[i]/X
        if c == int(c):
            m += int(c) - 1
        else:
            m += int(c)
    if m <= K:
        R = X
    else:
        L = X
if int(R) - int(L) == 0:
    print(int(R)+1)
else:
    print(int(R))
N, K = map(int, input().split())
A = list(map(int, input().split()))

def is_ok(arg):
  cnt = 0
  for i in range(N):
    cnt += (A[i]-1)//arg
  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

ans = meguru_bisect(0, 10**9)
print(ans)
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    c = 0
    for x in a:
        c += -(-x//arg) - 1
    return c <= 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

n,k = map(int,input().split())
a = list(map(int,input().split()))
print(meguru_bisect(0,10**9+1))
n, k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
low, high = 0, max(arr) + 1
while high - low > 1:
  mid = (high + low) // 2
  curr = 0
  for i in arr:
    curr += (i - 1)//mid
  if curr > k:
    low = mid
  else:
    high =  mid
print(high)
N, K = map(int, input().split()[:2])
arr = list(map(int, input().split()[:N]))


def pos(X):
    sum = 0
    for i in arr:
        sum += int(i/X)
        if i % X == 0:
            sum -= 1
    return sum <= K


low = 1
high = 10 ** 9
mid = 0
ans = 10**9

while low <= high:
    mid = int((low+high)/2)
    # print(low, mid, high)
    if pos(mid):
        ans = mid
        high = mid-1
    else:
        low = mid+1
    # print(pos(mid))
print(ans)
from math import ceil

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


def check(l):
    cnt = sum(ceil(a / l) - 1 for a in A)
    return cnt <= K

lb, ub = 0, max(A)
for _ in range(50):
    mid = (lb + ub) / 2
    if check(mid):
        ub = mid
    else:
        lb = mid
print(ceil(ub))
n, k = map(int, input().split())
A = list(map(int, input().split()))

right = 10**9
left=0

while right-left>1:
    mid=(left+right)//2
    count = 0
    for a in A:
        count+=a//mid
        if a%mid==0:
            count -=1
    if count<=k:
        right = mid
    else:
        left = mid
print(right)
import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

l, r = (A[0], 1)
def is_ok(c):
    x = sum([math.ceil(a/c)-1 for a in A])
    return x <= K

l, r = max(A), 0
while l - r > 1:
    c = (l + r) // 2
    if is_ok(c):
        l = c
    else:
        r = c
print(l)
import math
n,k=map(int,input().split())
log=list(map(int,input().split()))
a=0
b=max(log)
if b==1:
  print(1)
  exit()
c=(a+b)//2
while True:
  div=0
  for i in range(n):
    div+=math.ceil(log[i]/c)-1
  if div<=k:
    b=c
    c=(a+b)//2
  else:
    a=c
    c=(a+b)//2
    
  if c==a or c==b:
    break
print(b)
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
ok=10**10
ng=1
for i in range(40):
    chk=(ok+ng)//2
    cnt=0
    for j in range(n):
        cnt+=(a[j]+chk-1)//chk-1
    if cnt > k:
        ng = chk
    else:
        ok = chk
print(ok)
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

left = 0 # できない
right = a[0] # できる
while left+1 < right:
    mid = (left+right) // 2
    cnt = 0
    for i in range(n):
        if a[i]%mid == 0:
            cnt += a[i] // mid - 1
        else:
            cnt += a[i] // mid
        if cnt > k: break
    if cnt > k:
        left = mid
    else:
        right = mid
print(right)
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]
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[sum(int(a/t)-1 for a in A) -k-1])
_, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, 1<<30
while ok - ng > 1:
    m = (ng + ok) // 2
    if k < sum(map(lambda a: (a-1)//m, A)): ng = m
    else: ok = m
print(ok)
from math import ceil


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


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

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

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

while r - l > 1:
    now = (l + r)//2
    for i in a:
        ref += 0 - -i//now - 1
    if ref <= k:
        ref = 0
        r = now
    else:
        ref = 0
        l = now
print(r)
n,k=map(int,input().split())
a=list(map(int,input().split()))
ng=0
ok=max(a)
while ng+1!=ok:
  mid=(ng+ok)//2
  ans=0
  for i in a:
    ans+=0--i//mid-1
  if ans<=k:ok=mid
  else:ng=mid
print(ok)
N, K = map(int, input().split())
A = list(map(int, input().split()))


x0, x1 = 0, 10**9
while x0+1 < x1:
    x = (x0+x1)//2
    s = sum((a-1)//x for a in A)
    
    if s > K:
        x0 = x
    else:
        x1 = x

print(x1)
from sys import stdin
from math import floor,ceil

N, K = map(int, input().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]

def is_max_len_less_than_input(x,K,A):
  count = 0
  for ln in A:
    count += ceil(ln/x)-1
    if count > K:
      return False
  return True

def binary_search(begin,end,K,A):
  while abs(end-begin)>1:
    mid = (begin+end)//2
    if is_max_len_less_than_input(mid,K,A):
      end = mid
    else:
      begin = mid
  return end

print(binary_search(0,max(A),K,A))
import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k==1 or sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1
def is_good(mid, key):
    return sum(count_cuts(a, mid) for a in A) <= key


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


def count_cuts(a, unit):
    return (a + unit - 1) // unit - 1


N, K, *A = map(int, open(0).read().split())
print(binary_search(K))
N,K=map(int,input().split())
A=list(map(int,input().split()))
low=0
high=max(A)
while high-low>1:
    mid=(low+high)//2
    cnt=0
    for i in A:
        cnt+=(i-1)//mid
    if cnt>K:
        low=mid
    else:
        high=mid
print(high)
def main():
    n,k=map(int,input().split())
    lst=sorted(list(map(int,input().split())))
    
    left=0
    right=lst[-1]
    while right-left>1:
        mid=(right+left)//2
        sm=0
        for x in lst:
            sm+=(x-1)//mid
        
        if sm<=k:
            right=mid
        else : left=mid
    print(right)

main()
# 入力
n, k = map(int, input().split())
A = list(map(int, input().split()))

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

# めぐる式二分探索
ok = 10 ** 10
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())
As = list(map(int, input().split()))

def isOK(L):
    num = 0
    for A in As:
        num += -(-A // L) - 1
    return num <= K

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

k = int(-(-ok // 1))
#print('ok:', ok, '/ k:', k)

for L in range(max(1, k-2), k+3):
    if isOK(L):
        print(L)
        break
def isok(mid):
    cnt = 0
    for i in range(N):
        if A[i] % mid == 0:
            cnt += A[i]/mid-1
        else:
            cnt += A[i]//mid
    if cnt <= K:
        return True
    else:
        return False

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
    if isok(mid):
        right = mid
    else:
        left = mid
print(right)
n,k=map(int,input().split())
a=list(map(int,input().split()))
ok=10**10
ng=1
for i in range(40):
    chk=(ok+ng)//2
    cnt=0
    for j in range(n):
        cnt+=(a[j]+chk-1)//chk-1
    if cnt > k:
        ng = chk
    else:
        ok = chk
print(ok)
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
t = 0
for i in range(n):
    y = int(a[i]/s * k)
    x[i] = [i, a[i], y, a[i]/(y+1)]
    t += y
x.sort(key= lambda val : val[3],reverse=True)
for i in range(k-t):
    x[i][2] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][1]/(x[i][2]+1))
print(int(-(-ans//1)))
n,k=map(int, input().split())
A=[int(i) for i in input().split()]
ng=0
ok = max(A)
while(ng+1!=ok):
    mid = (ok+ng)//2
    ans = 0
    for i in A:
        ans += 0--i//mid-1
    if(ans<=k):
        ok = mid
    else:
        ng = mid
print(ok)
import numpy as np
import math
N, K = map(int, input().split())
aaa = np.array(list(map(float, input().split())), dtype='f8')
l = 0
r = 10 ** 9
while r != l:
    mid = (r + l) // 2
    bbb = aaa / mid
    bbb -= 1
    bbb = np.ceil(bbb)
    if bbb.sum() <= K:
        r = mid
    else:
        l = mid + 1
print(l)
from math import ceil
def C(x):
  cnt = 0
  for i in range(n):
    cnt += ceil(a[i] / x) - 1
  if cnt > k:
    return False
  else:
    return True
  
n, k = map(int, input().split())
a = list(map(int, input().split()))
lb = 0
ub = 1000000000
while ub - lb > 1:
  mid = (lb + ub) // 2
  if C(mid):
    ub = mid
  else:
    lb = mid
print(ub)
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(A, K):
    l, r = 0, 1 << 30

    def test(x):
        return np.sum((A + x - 1) // x - 1) <= K

    while l + 1 < r:
        m = (l + r) // 2
        if test(m):
            r = m
        else:
            l = m
    return r

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

print(main(A, K))
# 解答
N, K  = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

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

  return True

l = 0
r = A[0]

while r-l > 1:
  c = (r+l)//2
  if check(c):
    r = c
  else:
    l = c
print(r)
N,K=map(int,input().split())
A=list(map(int,input().split()))
l=0
r=10**9
while l+1<r:
    m=(r-l)//2+l
    c=0
    for i in A:
        c+=(i-1)//m
    if c<=K:
        r=m
    else:
        l=m
print(l+1)
from math import ceil
N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))
if K==0:print(max(A));exit()

left,right=0,10**9+1
while right>left+1:
    cnt=K
    mid=(left+right)//2
    for i in range(N):
        cnt -=ceil(A[i]/mid)-1
    if cnt>=0:right=mid
    elif cnt<0:left=mid

print(right)
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
l = 1
r = max(a)

while l < r:
    m = (l + r) // 2
    cnt = 0
    for v in a:
        if m == 0:
            cnt += 2 * v
        else:
            cnt += (v + m - 1) // m - 1
    if cnt <= k:
        r = m
    else:
        l = m + 1

print(l)
import sys
input = sys.stdin.readline



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

def determine(L):
    if L == 0:
        return False
    ret = 0
    for a in A:
        k = a // L
        if k * L == a:
            k -= 1
        ret += k

    if ret <= K:
        return True

    else:
        return False



L = 0
R = 10 ** 9

while L + 1 < R:
    mid = (L + R) // 2
    if determine(mid):
        R = mid
    else:
        L = mid

print(R)
import math

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

A.sort()
def isPossible(maxL):
    cuts = 0
    for x in A:
        if x > maxL:
            cuts += math.ceil(x / maxL) - 1
    return cuts <= K

lo = 0
hi = max(A)
EPS = 10e-7
while hi - lo > EPS:
    mid = (lo + hi) / 2
    if isPossible(mid):
        hi = mid
    else:
        lo = mid

print(math.ceil(hi))
import math

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

    def _f(length: int) -> bool:
        count = 0
        for a in A:
            count += int((a-1) / length)
        return count <= K

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

if __name__ == "__main__":
    resolve()
import math
def solution(x):
  p = sum([math.ceil(a[i]/x)-1 for i in range(N)])
  return p
def solvance(y,z):
  if z-y <= 1:
    return z
  else:
    w = (y+z)//2
    #print(y,w,z)
    if solution(w) > K:
      return solvance(w,z)
    else:
      return solvance(y,w)

N,K = map(int,input().split())
a = list(map(int,input().split()))
if K == 0:
  print(max(a))
else:
  ansM = (sum(a)//K)+1
  ansm = sum(a)//(K+N)
  ans = solvance(ansm,ansM)
  print(ans)