output_description: Print the minimum value of $P$ in a line.
input_description: In the first line, two integers $n$ and $k$ are given separated by a space
  character. In the following $n$ lines, $w_i$ are given respectively.
attempt: # encoding: utf-8
  
  
  import sys
  import math
  
  
  class Solution:
      def __init__(self):
          """
          init input array
          """
          self.__input = sys.stdin.readlines()
  
      @property
      def solution(self):
          product_num = int(self.__input[0].split()[0])
          truck_num = int(self.__input[0].split()[1])
  
          weight_list = list(map(int, self.__input[1:]))
  
          assert product_num == len(weight_list)
          # print(product_num, truck_num, weight_list)
  
          truck_capacity = max(math.ceil(sum(weight_list) / truck_num), max(weight_list))
  
          return str(truck_capacity)
  
          #     for each in array_2:
          #         if self.allocation(key=each, array=weight_list, array_length=max(weight_list)):
          #             truck_capacity += 1
          #
          #     return str(truck_capacity)
          #
          # @staticmethod
          # def allocation(key, array, array_length):
          #     # print(len(set(array_1).intersection(set(array_2))))
          #     left, right = max(array), array_length
          #     while left < right:
          #         mid = (left + right) // 2
          #         if key == array[mid]:
          #             return True
          #         elif key < array[mid]:
          #             right = mid
          #         else:
          #             left = mid + 1
          #     return False
  
  
  if __name__ == "__main__":
      case = Solution()
      print(case.solution)
  
problem_description: Input
  
  In the first line, two integers $n$ and $k$ are given separated by a space
  character. In the following $n$ lines, $w_i$ are given respectively.
samples: [{"input": "5 3\n    8\n    1\n    7\n    3\n    9", "output": "10\n    \n\nIf the first truck loads two packages of $\\\\{8, 1\\\\}$, the second truck loads\ntwo packages of $\\\\{7, 3\\\\}$ and the third truck loads a package of $\\\\{9\\\\}$,\nthen the minimum value of the maximum load $P$ shall be 10."}, {"input": "4 2\n    1\n    2\n    2\n    6", "output": "6\n    \n\nIf the first truck loads three packages of $\\\\{1, 2, 2\\\\}$ and the second\ntruck loads a package of $\\\\{6\\\\}$, then the minimum value of the maximum load\n$P$ shall be 6."}]