import numpy as np
from numba import jit
import random
verbose = False
rand = False

if rand:
    N, K = random.choice(range(10)), random.choice(range(10))
    A = np.array(random.choices(range(10**9), k=N))
else:
    N, K = list(map(int, input().split()))
    A = np.array(list(map(int, input().split())), dtype=np.int64)

ul = np.ceil(np.sum(A)/(K+1))
ll= np.floor(np.max(A)/(K+1))

EPS = 1 / 10**6

@jit(nopython=True)
def cut(A, c, N):
    return (np.sum(np.ceil(A/c))-N)

c = np.ceil((ul+ll)/2)
mx = np.max(A)
while True:
    if ul-ll <= 1:
        break
    nk = cut(A, c, N)
    if verbose:
        print('c:', c, 'nk:', nk, 'ul - ll:', ul, '/', ll)
    prev = c
    if nk  >K: # more cuts than target; larger logs can be made
        ll = c
        c = np.floor((ul + c)/2)
    else: #i.e. nk < K, less cuts than target
        ul = c
        c = np.ceil((c + ll)/2)
        
if cut(A, ll+EPS, N) >= K:
    print(np.min((np.max(A), int(ul))))
else:
    print(int(ll))
     import numpy as np numpy from numba import jit import random random verbose = False verbose False rand = False rand False if rand:
    N, K = random.choice(range(10)), random.choice(range(10))
    A = np.array(random.choices(range(10**9), k=N))
else:
    N, K = list(map(int, input().split()))
    A = np.array(list(map(int, input().split())), dtype=np.int64) rand N, K = random.choice(range(10)), random.choice(range(10)) N random.choice(range(10)) random.choice random choice range(10) range 10 K random.choice(range(10)) random.choice random choice range(10) range 10 A = np.array(random.choices(range(10**9), k=N)) A np.array(random.choices(range(10**9), k=N)) np.array np array random.choices(range(10**9), k=N) random.choices random choices range(10**9) range 10**9 10 9 k=N k N N, K = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K A = np.array(list(map(int, input().split())), dtype=np.int64) A np.array(list(map(int, input().split())), dtype=np.int64) np.array np array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split dtype=np.int64 dtype np.int64 np int64 ul = np.ceil(np.sum(A)/(K+1)) ul np.ceil(np.sum(A)/(K+1)) np.ceil np ceil np.sum(A)/(K+1) np.sum(A) np.sum np sum A K+1 K 1 ll= np.floor(np.max(A)/(K+1)) ll np.floor(np.max(A)/(K+1)) np.floor np floor np.max(A)/(K+1) np.max(A) np.max np max A K+1 K 1 EPS = 1 / 10**6 EPS 1 / 10**6 1 10**6 10 6 def cut(A, c, N):
    return (np.sum(np.ceil(A/c))-N) cut return (np.sum(np.ceil(A/c))-N) np.sum(np.ceil(A/c))-N np.sum(np.ceil(A/c)) np.sum np sum np.ceil(A/c) np.ceil np ceil A/c A c N A A c c N N @jit(nopython=True) cut nopython=True @jit(nopython=True) jit nopython=True nopython True cut c = np.ceil((ul+ll)/2) c np.ceil((ul+ll)/2) np.ceil np ceil (ul+ll)/2 ul+ll ul ll 2 mx = np.max(A) mx np.max(A) np.max np max A while True:
    if ul-ll <= 1:
        break
    nk = cut(A, c, N)
    if verbose:
        print('c:', c, 'nk:', nk, 'ul - ll:', ul, '/', ll)
    prev = c
    if nk  >K: # more cuts than target; larger logs can be made
        ll = c
        c = np.floor((ul + c)/2)
    else: #i.e. nk < K, less cuts than target
        ul = c
        c = np.ceil((c + ll)/2)
         True if ul-ll <= 1:
        break
     ul-ll <= 1 ul-ll ul ll 1 break nk = cut(A, c, N) nk cut(A, c, N) cut A c N if verbose:
        print('c:', c, 'nk:', nk, 'ul - ll:', ul, '/', ll)
     verbose print('c:', c, 'nk:', nk, 'ul - ll:', ul, '/', ll) print 'c:' c 'nk:' nk 'ul - ll:' ul '/' ll prev = c prev c if nk  >K: # more cuts than target; larger logs can be made
        ll = c
        c = np.floor((ul + c)/2)
    else: #i.e. nk < K, less cuts than target
        ul = c
        c = np.ceil((c + ll)/2)
         nk  >K nk K ll = c ll c c = np.floor((ul + c)/2) c np.floor((ul + c)/2) np.floor np floor (ul + c)/2 ul + c ul c 2 ul = c ul c c = np.ceil((c + ll)/2) c np.ceil((c + ll)/2) np.ceil np ceil (c + ll)/2 c + ll c ll 2 if cut(A, ll+EPS, N) >= K:
    print(np.min((np.max(A), int(ul))))
else:
    print(int(ll))
     cut(A, ll+EPS, N) >= K cut(A, ll+EPS, N) cut A ll+EPS ll EPS N K print(np.min((np.max(A), int(ul)))) print np.min((np.max(A), int(ul))) np.min np min (np.max(A), int(ul)) np.max(A) np.max np max A int(ul) int ul print(int(ll)) print int(ll) int ll def cut(A, c, N):
    return (np.sum(np.ceil(A/c))-N) def cut(A, c, N):
    return (np.sum(np.ceil(A/c))-N) cut N, K = list(map(int, input().split())) list(map(int, input().split())) N c = np.floor((ul + c)/2) np.floor((ul + c)/2) c prev = c c prev ll = c c ll rand = False False rand ul = c c ul c = np.ceil((c + ll)/2) np.ceil((c + ll)/2) c N, K = random.choice(range(10)), random.choice(range(10)) random.choice(range(10)) N A = np.array(list(map(int, input().split())), dtype=np.int64) np.array(list(map(int, input().split())), dtype=np.int64) A EPS = 1 / 10**6 1 / 10**6 EPS K = list(map(int, input().split())) list(map(int, input().split())) K nk = cut(A, c, N) cut(A, c, N) nk K = random.choice(range(10)), random.choice(range(10)) random.choice(range(10)) K A = np.array(random.choices(range(10**9), k=N)) np.array(random.choices(range(10**9), k=N)) A ll= np.floor(np.max(A)/(K+1)) np.floor(np.max(A)/(K+1)) ll mx = np.max(A) np.max(A) mx c = np.ceil((ul+ll)/2) np.ceil((ul+ll)/2) c ul = np.ceil(np.sum(A)/(K+1)) np.ceil(np.sum(A)/(K+1)) ul verbose = False False verbose
import numpy as np
from numba import jit
import random
verbose = False
rand = False

if rand:
    N, K = random.choice(range(10)), random.choice(range(10))
    A = np.array(random.choices(range(10**9), k=N))
else:
    N, K = list(map(int, input().split()))
    A = np.array(list(map(int, input().split())), dtype=np.int64)

ul = np.ceil(np.sum(A)/(K+1))
ll= np.floor(np.max(A)/(K+1))

EPS = 1 / 10**6

@jit(nopython=True)
def cut(A, c, N):
    return (np.sum(np.ceil(A/c))-N)

c = np.ceil((ul+ll)/2)
mx = np.max(A)
while True:
    if ul-ll <= 1:
        break
    nk = cut(A, c, N)
    if verbose:
        print('c:', c, 'nk:', nk, 'ul - ll:', ul, '/', ll)
    prev = c
    if nk  >K: # more cuts than target; larger logs can be made
        ll = c
        c = np.floor((ul + c)/2)
    else: #i.e. nk < K, less cuts than target
        ul = c
        c = np.ceil((c + ll)/2)
        
if cut(A, ll+EPS, N) >= K:
    print(np.min((np.max(A), int(ul))))
else:
    print(int(ll))
    
