CodeEff/ECCO huggingface dataset:
# Original solution
n, k = tuple(map(int, input().split()))
arr = [0 for i in range(n)]
sums = 0
for i in range(n):
    inp = int(eval(input()))
    arr[i] = inp

arr.sort()

sa = 1000000000
for i in range(n-k+1):
    newsa = max(arr[i:i+k]) - min(arr[i:i+k])
    if newsa < sa:
        sa = newsa

print(sa)


# Optimized solution
n, k = tuple(map(int, input().split()))
arr = [0 for i in range(n)]
sums = 0
for i in range(n):
    inp = int(eval(input()))
    arr[i] = inp

arr.sort()

sa = 1000000000
for i in range(n-k+1):
    newsa = arr[i+k-1] - arr[i]
    if newsa < sa:
        sa = newsa

print(sa)
# Original solution
N_K = input().split()
N = int(N_K[0])
K = int(N_K[1])
Hs = sorted([int(eval(input())) for i in range(N)])
Hs_diff = [Hs[i+1] - Hs[i] for i in range(N) if i<(N-1)]
Hs_diff_K = [sum(Hs_diff[(i):(i+K-1)]) for i in range(len(Hs_diff)) if i < len(Hs_diff)-K+2]
print((min(Hs_diff_K)))

# Optimized solution
N_K = input().split()
N = int(N_K[0])
K = int(N_K[1])
Hs = sorted([int(eval(input())) for i in range(N)])
Hs_diff_K = [Hs[K+i-1] - Hs[i] for i in range(N) if i < N-K+1]
print((min(Hs_diff_K)))
# Original solution
while 1:
    n=list(map(int,input().split()))
    if n[0]==0:break
    a=0
    for i in range(n[0],n[1]+1):
        b=i
        while b%2==0: b/=2
        while b%3==0: b/=3
        while b%5==0: b/=5
        if b==1:a+=1
    print(a)

# Optimized solution
while 1:
    n=list(map(int,input().split()))
    if n[0]==0:break
    a=0
    for i in range(n[0],n[1]+1):
        b=i
        while b%5==0: b/=5
        while b%3==0: b/=3
        while b%2==0: b/=2
        if b==1:a+=1
    print(a)
# Original solution
def two(n):
    if n == 1:
        return True
    elif n%2 != 0:
        return three(n)
    else:
        q = n/2
        return two(q)

def three(n):
    if n == 1:
        return True
    elif n%3 != 0:
        return five(n)
    else:
        q = n/3
        return three(q)

def five(n):
    if n == 1:
        return True
    elif n%5 != 0:
        return False
    else:
        q = n/5
        return two(q)

while True:
    input_line = input()
    if input_line == '0': break
    m, n = list(map(int, input_line.split()))
    c = 0
    for n in range(m, n+1):
        if two(n):
            c += 1
    else:
        print(c)

# Optimized solution
def two(n):
    if n == 1:
        return True
    elif n%2 != 0:
        return three(n)
    else:
        q = n/2
        return two(q)

def three(n):
    if n == 1:
        return True
    elif n%3 != 0:
        return five(n)
    else:
        q = n/3
        return three(q)

def five(n):
    if n == 1:
        return True
    elif n%5 != 0:
        return False
    else:
        q = n/5
        return five(q)

while True:
    input_line = input()
    if input_line == '0': break
    m, n = list(map(int, input_line.split()))
    c = 0
    for n in range(m, n+1):
        if two(n):
            c += 1
    else:
        print(c)
# Original solution
import heapq
n, k = list(map(int, input().split()))
list_A = list(map(int, input().split()))
list_H = []

for a in list_A:
    list_H.append(((-1)*a, a, 1))
heapq.heapify(list_H)

for _ in range(k):
    l = heapq.heappop(list_H)
    c = 0
    if l[1] % (l[2]+1) == 0:
        c = l[1] // (l[2]+1)
    else:
        c = l[1] // (l[2]+1) + 1

    h = ((-1)*c, l[1], l[2]+1)
    heapq.heappush(list_H, h)

ans = heapq.heappop(list_H)
print((abs(ans[0])))

# Optimized solution
n, k = list(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)
# Original solution
import math
import heapq

n, k = list(map(int, input().split()))
a = [(-int(x), 1) for x in input().split()]
heapq.heapify(a)

for i in range(k):
  key = heapq.heappop(a)
  heapq.heappush(a, (key[0]*key[1]/(key[1]+1), key[1]+1))

print((math.ceil(-heapq.heappop(a)[0])))

# Optimized solution
import math

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

l, r = 0, 10**9+2

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

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


# Optimized solution
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)
# Original solution
import math

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

a.sort()
r = a[n-1]
l = 0


def calc(t,x):
    return math.ceil(t / x) - 1


while r - l > 1:
    mid = (r+l)//2
    count = 0
    for i in a:
        count += calc(i,mid)
    if count > k:
        l = mid
    else:
        r = mid

print(r)


# Optimized solution
import math

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

a.sort()
r = a[n-1]
l = 0


def calc(t,x):
    return (t-1) // x


while r - l > 1:
    mid = (r+l)//2
    count = 0
    for i in a:
        count += calc(i,mid)
    if count > k:
        l = mid
    else:
        r = mid

print(r)
# Original solution
from math import ceil
from fractions import Fraction
from sys import exit
import heapq

n,k, *aa = list(map(Fraction, open(0).read().split()))

left = k/2
right = k*2 + 1
mid = k/2
summ = sum(aa)
score = None
while 1:
    x = [(ceil(mid*a/summ), a) for a in aa]
    prev = score
    score = sum(a[0]-1 for a in x)
    if prev == score:
        break
    if score > k:
        right = mid
        mid = (left + right) / 2
    elif score < k:
        left = mid
        mid = (left + right) / 2
    else:
        values = [ceil(a/v) for v,a in x]
        print((max(values)))
        exit()

x = [(-a/c, c, a) for c,a in x]
heapq.heapify(x)

for _ in range(int(k-score)):
    v,c,a = heapq.heappop(x)
    c += 1
    v = -a/c
    heapq.heappush(x, (v,c,a))

print((ceil(-x[0][0])))

# Optimized solution
from math import ceil

n,k, *aa = list(map(int, open(0).read().split()))

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right) // 2
    summ = sum(0--a//mid-1 for a in aa)
    if summ <= k:
        right = mid
    else:
        left = mid

print(right)
# Original solution
from math import ceil
from fractions import Fraction

n, k, *aa = list(map(Fraction, 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(ceil(a / mid) - 1 for a in aa)
    if cost <= k:
        psbl_length = mid
    else:
        imp_length = mid

print(psbl_length)

# Optimized solution
n, k, *aa = list(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)
# Original solution
import math 
N,K=list(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):
        if A[i]%mid==0:
            numofcut+=(A[i]//mid) -1
        else:
            numofcut+=A[i]//mid
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)

# Optimized solution
import math 
N,K=list(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)
# Original solution
"""
AtCoder :: Beginner Contest 174 :: Logs
https://atcoder.jp/contests/abc174/tasks/abc174_e
"""
import sys
import math
import heapq


def main():
    """Main program."""
    log_count, cut_count = (int(i) for i in sys.stdin.readline().split())
    logs = [(-float(i), 0, float(i)) for i in sys.stdin.readline().split()]
    heapq.heapify(logs)
    for _ in range(cut_count):
        curr_length, cuts, init_length = heapq.heappop(logs)
        curr_length, cuts = -curr_length, -cuts
        cuts += 1
        curr_length = init_length / (cuts + 1)
        heapq.heappush(logs, (-curr_length, -cuts, init_length))
    print((math.ceil(-logs[0][0])))


if __name__ == '__main__':
    main()

# Optimized solution
"""
AtCoder :: Beginner Contest 174 :: Logs
https://atcoder.jp/contests/abc174/tasks/abc174_e
"""
import sys
from math import ceil


def main():
    """Main program."""
    log_count, cut_count = (int(i) for i in sys.stdin.readline().split())
    logs = [int(i) for i in sys.stdin.readline().split()]
    high = max(logs)
    low = 1
    soln = high
    # Binary search for the answer.
    while low <= high:
        mid = (low + high) // 2
        cuts_needed = sum([int(ceil(log / mid)) - 1 for log in logs])
        if cuts_needed <= cut_count:
            soln = min(soln, mid)
            high = mid - 1
        else:
            low = mid + 1
    print(soln)


if __name__ == '__main__':
    main()
# Original solution
def main():
  n, k = list(map(int, input().split()))
  a = list(map(int, input().split()))

  for i in range(n):
    a[i] = [(-1) * a[i], (-1) * a[i], 1]

  import heapq
  heapq.heapify(a)

  for _ in range(k):
    i = heapq.heappop(a)
    i[2] += 1
    i[0] = i[1] / i[2]
    heapq.heappush(a, i)

  from math import ceil
  print((ceil((-1) * heapq.heappop(a)[0])))

main()

# Optimized solution
n, k = list(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)
# Original solution
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[41]:


cnt = 0
low = 0
high = max(A)
ans = max(A)
old = int(high)
mycount = 0
while low < high:
    mid = (high+low)/2
    cnt = sum([(x-0.001)//mid for x in A])
    if cnt <= K:
        high = mid
        ans = min(ans, int(-(-mid//1)))
    else:
        low = mid
    if int(mid) == old:
        mycount += 1
    if mycount == 100:
        break
    old = int(mid)
print(ans)


# In[ ]:






# Optimized solution
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[49]:


low = 0
high = max(A)
def ok(x):
    cnt = 0
    for a in A:
        cnt += (a//x)
        if a%x == 0:
            cnt -= 1
    return cnt <= K
 
while high-low > 1:
    mid = (high+low)//2
    if ok(mid):
        high = mid
    else:
        low = mid
print(high)


# In[ ]:
# Original solution
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate
import math

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    q = []
    for i in range(N):
        heappush(q,(-A[i],0))

    for i in range(K):
        l, c = heappop(q)
        heappush(q,(l*(c+1)/(c+2),c+1))
    
    ans = 0
    while q:
        l,c = heappop(q)
        ans = max(ans,-l)
    print((math.ceil(ans)))

if __name__ == "__main__":
    main()

# Optimized solution
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate
import math

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    if K == 0:
        print((max(A)))
        exit()
    
    # 二分探索で答えxを求める
    MIN = 0
    MAX = max(A)

    while MAX - MIN > 1:
        MID = (MIN + MAX)//2
        cnt = 0
        for i in range(N):
            cnt += (A[i]-1)//MID
        if cnt <= K:
            MAX = MID
        else:
            MIN = MID
    print(MAX)

if __name__ == "__main__":
    main()
# Original solution
# https://atcoder.jp/contests/abc174/tasks/abc174_e

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

L=0
R=max(A)
i=0
ans=(L+R)/2
cnt=0
right=0
left=0

while i<1000:
    i +=1
    for num in A:
        cnt += ceil(num/ans)-1
    if cnt <=K:
        R = ans
    elif cnt>=K:
        L = ans
    else:
        #print("fin",i-1,cnt,ans)
        break           
    ans = (R+L)/2
    cnt=0
        
print((ceil(ans)))

# Optimized solution
# https://atcoder.jp/contests/abc174/tasks/abc174_e

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

L=0
R=max(A)
i=0
ans=(L+R)/2
cnt=0
right=0
left=0

while i<100:
    i +=1
    for num in A:
        cnt += ceil(num/ans)-1
    if cnt <=K:
        R = ans
    elif cnt>=K:
        L = ans
    else:
        #print("fin",i-1,cnt,ans)
        break           
    ans = (R+L)/2
    cnt=0
        
print((ceil(ans)))
# Original solution
#!/usr/bin/env python3
from bisect import insort_left
from collections import deque
from math import ceil

n, k = list(map(int, input().split()))
a = [[i, 1] for i in map(int, input().split())]
A = sorted(a)
while k > 0:
    q, c = A.pop()
    insort_left(A, [q * c / (c + 1), c + 1])
    k -= 1
print((ceil(A[-1][0])))


# Optimized solution
#!/usr/bin/env python3
from bisect import bisect_left

n, k = list(map(int, input().split()))
*a, = list(map(int, input().split()))
def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    return sum(-(-i // arg) - 1 for i in a) <= k


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    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))))
# Original solution
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))

x=0
y=max(A)

def f(l):
  nums=0
  for a in A:
    t=1
    while a/t>l:
      t+=1
    nums+=t-1
  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)

# Optimized solution
N, K=list(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)
# Original solution
import heapq
import math

def solve():
    N, K = list(map(int, input().split()))
    A = list([(-float(a), -int(a), 1) for a in input().split()])
    heapq.heapify(A)
    for _ in range(K):
        a = heapq.heappop(A)
        heapq.heappush(A, (a[1] / (a[2] + 1.0), a[1], a[2]+1))

    ans = -heapq.heappop(A)[0]
    print((math.ceil(ans)))

solve()

# Optimized solution
import heapq
import math

def solve():
    N, K = list(map(int, input().split()))
    A = sorted(map(int, input().split()), reverse=True)
    l = 0
    r = A[0]
    # (l, r]
    #print(A)
    #print("K=",K)
    while r - l> 1:
        m = (r + l) // 2
        cuts = 0
        for a in A:
            cuts += (a-1) // m
        #print(l, m,r, cuts)
        if cuts <= K:
            r = m
        else:
            l = m
    print(r)

solve()
# Original solution
import bisect
n,k = list(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)

# Optimized solution
#!/usr/bin python3
# -*- coding: utf-8 -*-

import bisect
n,k = list(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)
# Original solution
#abc174_e
from math import ceil
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()

if k==0:
    ans=max(a)
    print(ans)
    exit()
if k==1:
    if n==1:
        print((-(-a[0]//2)))
        exit()
    ans=max(a[-1]/2,a[-2])
    print((ceil(ans)))
    
ok=10**9+1
ng=1
def check(x):
    k_cnt=0
    for q in a:
        k_cnt+=ceil(q/x-1)
    if k_cnt<=k:
        return True
    else:
        return False

    
for i in range(1000):
    mid=(ok+ng)/2
    if check(mid):
        ok=mid
    else:
        ng=mid
    # print(ok,ng)
print((ceil(ok)))


# Optimized solution
#abc174_e
from math import ceil
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()

if k==0:
    ans=max(a)
    print(ans)
    exit()
if k==1:
    if n==1:
        print((-(-a[0]//2)))
        exit()
    ans=max(a[-1]/2,a[-2])
    print((ceil(ans)))
    exit()
    
ok=10**9+1
ng=1
def check(x):
    k_cnt=0
    for q in a:
        k_cnt+=ceil(q/x-1)
    if k_cnt<=k:
        return True
    else:
        return False

    
for i in range(100):
    mid=(ok+ng)/2
    if check(mid):
        ok=mid
    else:
        ng=mid
    # print(ok,ng)
print((ceil(ok)))
# Original solution
from math import *
f=lambda:[*list(map(int,input().split()))]
n,k=f()
a=f()
def ok(x):
  c=0
  for i in a:
    c+=ceil(i/x)
  return c<=n+k
l,r=0,10**9
while r-l>1:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
t=ceil(r)
print((t-ok(t-1) if t>1 else t))

# Optimized solution
f=lambda:[*list(map(int,input().split()))]
n,k=f()
a=f()
def ok(x):
  c=0
  for i in a:
    c+=0--i//x
  return c<=n+k
l,r=0,10**9
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
print(r)
# Original solution
from functools import cmp_to_key
import heapq


def func(a, b):
    if a[0] * b[1] == a[1] * b[0]:
        return 0
    elif a[0] * b[1] > a[1] * b[0]:
        return - 1
    else:
        return 1


n, k = list(map(int, input().split()))
c = cmp_to_key(func)
hq = list([c((int(x), 1)) for x in input().split()])
heapq.heapify(hq)
for _ in range(k):
    t = heapq.heappop(hq).obj
    heapq.heappush(hq, c((t[0], t[1] + 1)))
t = heapq.heappop(hq).obj
print(((t[0] - 1) // t[1] + 1))


# Optimized solution
n, k = list(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)
# Original solution
import math

n , k = list(map(int, input().split()))
a = list(map(int,input().split()))
b = [1]*n

for i in range(k):
    t = a.index(max(a))
    a[t]=a[t]*b[t]/(b[t]+1)
    b[t]+=1

print((math.ceil(max(a))))


# Optimized solution
import math

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

left=0
right=max(a)
mid = (left+right)/2
while right - left > 0.5:
    times = 0
    for i in range(n):
        times+=math.ceil(a[i]/mid)-1
    if times<=k:
        right=mid
        mid=(left+right)/2
    else:
        left = mid
        mid =(left+right)/2

print((math.ceil(mid)))
# Original solution
from heapq import heappush, heappop


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    h = []
    for a in A:
        heappush(h, [-a, a, 1])
    for i in range(K):
        pri, origlen, cut = heappop(h)
        heappush(h, [-origlen//(cut+1), origlen, cut+1])
    ans = -h[0][0]
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
def countcut(A, length):
    ret = 0
    for a in A:
        ret += -(-a//length) - 1
    return ret


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    lo = 1
    hi = int(1e9)
    while lo < hi:
        mid = (lo+hi) // 2
        if countcut(A, mid) <= K:
            hi = mid
        else:
            lo = mid + 1
    print(lo)


if __name__ == "__main__":
    main()
# Original solution
# coding: utf-8

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

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

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

    return str(-int(-l//1))


if __name__ == "__main__":
    print((solve(*(open(0).read().splitlines()))))


# Optimized solution
# coding: utf-8

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

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

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

    return str(-int(-l//1))


if __name__ == "__main__":
    print((solve(*(open(0).read().splitlines()))))
# Original solution
# coding: utf-8

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

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

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

    return str(-int(-l//1))


if __name__ == "__main__":
    print((solve(*(open(0).read().splitlines()))))


# Optimized solution
# coding: utf-8

def solve(*args: str) -> str:
    n, k = list(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()))))
# Original solution
import heapq
from math import ceil
N, K = list(map(int, input().split()))

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

hp = []

for log in A:
    heapq.heappush(hp, (-log, log, 1))

for i in range(K):
    cur_length, length, count = heapq.heappop(hp)
    cur_length = -cur_length
    new_length = length / (count + 1)
    heapq.heappush(hp, (-new_length, length, count + 1))

print((ceil(-hp[0][0])))



# Optimized solution
from math import ceil
N, K = list(map(int, input().split()))

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

def possible(A, K, target):
    count = 0

    for a in A:
        count += ceil(a / target) - 1
    return count <= K

left = 1
right = max(A)

while left < right:
    mid = (left + right) // 2
    if possible(A, K, mid):
        right = mid
    else:
        left = mid + 1

print(right)