import math

from collections import deque

import numpy as np

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

A = np.array(input().split(), dtype=np.int64)

S = np.sum(A)

cut = K*A//S



length = []

for k in range(N):

  length.append([A[k] / (cut[k]+1), k])



length.sort(key = lambda x: x[0], reverse=True)



def nibun_insert(lis, item):

  end = len(lis)

  start = 0

  now = (end+start)//2

  while end > start+1:

    if lis[now][0] > item[0]:

      start = 0 + now

      now = (now + end)//2

    else:

      end = 0 + now

      now = (now + start)//2

  lis.insert(now+1, item)

  return lis



C = np.sum(cut)

res = K - C

length = length[:res+1]

length = deque(length)

for _ in range(res):

  a = length.popleft()

  cut[a[1]] += 1

  a[0] = a[0]*cut[a[1]]/(cut[a[1]]+1)

  if a[0] <= length[-1][0]:

    continue

  elif a[0] >= length[0][0]:

    length.appendleft(a)

  else:

    length = nibun_insert(length, a)

  length.pop()



print((math.ceil(length.popleft()[0])))
import math

from collections import deque

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

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

S = sum(A)

cut = []

for k in range(N):

  cut.append(K*A[k]//S)



length = []

for k in range(N):

  length.append([A[k] / (cut[k]+1), k])



length.sort(key = lambda x: x[0], reverse=True)



def nibun_insert(lis, item):

  end = len(lis)

  start = 0

  now = (end+start)//2

  while end > start+1:

    if lis[now][0] > item[0]:

      start = 0 + now

      now = (now + end)//2

    else:

      end = 0 + now

      now = (now + start)//2

  lis.insert(now+1, item)

  return lis



C = sum(cut)

res = K - C

length = length[:res+1]

length = deque(length)

for _ in range(res):

  a = length.popleft()

  cut[a[1]] += 1

  a[0] = a[0]*cut[a[1]]/(cut[a[1]]+1)

  if a[0] <= length[-1][0]:

    continue

  elif a[0] >= length[0][0]:

    length.appendleft(a)

  else:

    length = nibun_insert(length, a)

  length.pop()



print((math.ceil(length.popleft()[0])))
import math
from collections import deque
import numpy as np

N, K = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
S = np.sum(A)
cut = K * A // S
length = []
for k in range(N):
    length.append([A[k] / (cut[k] + 1), k])
length.sort(key=lambda x: x[0], reverse=True)


def nibun_insert(lis, item):
    end = len(lis)
    start = 0
    now = (end + start) // 2
    while end > start + 1:
        if lis[now][0] > item[0]:
            start = 0 + now
            now = (now + end) // 2
        else:
            end = 0 + now
            now = (now + start) // 2
    lis.insert(now + 1, item)
    return lis


C = np.sum(cut)
res = K - C
length = length[: res + 1]
length = deque(length)
for _ in range(res):
    a = length.popleft()
    cut[a[1]] += 1
    a[0] = a[0] * cut[a[1]] / (cut[a[1]] + 1)
    if a[0] <= length[-1][0]:
        continue
    elif a[0] >= length[0][0]:
        length.appendleft(a)
    else:
        length = nibun_insert(length, a)
    length.pop()
print((math.ceil(length.popleft()[0])))

import math
from collections import deque

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
S = sum(A)
cut = []
for k in range(N):
    cut.append(K * A[k] // S)
length = []
for k in range(N):
    length.append([A[k] / (cut[k] + 1), k])
length.sort(key=lambda x: x[0], reverse=True)


def nibun_insert(lis, item):
    end = len(lis)
    start = 0
    now = (end + start) // 2
    while end > start + 1:
        if lis[now][0] > item[0]:
            start = 0 + now
            now = (now + end) // 2
        else:
            end = 0 + now
            now = (now + start) // 2
    lis.insert(now + 1, item)
    return lis


C = sum(cut)
res = K - C
length = length[: res + 1]
length = deque(length)
for _ in range(res):
    a = length.popleft()
    cut[a[1]] += 1
    a[0] = a[0] * cut[a[1]] / (cut[a[1]] + 1)
    if a[0] <= length[-1][0]:
        continue
    elif a[0] >= length[0][0]:
        length.appendleft(a)
    else:
        length = nibun_insert(length, a)
    length.pop()
print((math.ceil(length.popleft()[0])))

-import numpy as np -A = np.array(input().split(), dtype=np.int64) -S = np.sum(A) -cut = K * A // S +A = list(map(int, input().split())) +S = sum(A) +cut = [] +for k in range(N): +    cut.append(K * A[k] // S) -C = np.sum(cut) +C = sum(cut)