LearnPy Hub
← Arena
AdvancedRating 1700

Split the Pages

n books with given page counts must be split, in order, among k students (each gets a contiguous non-empty block). Minimise the largest number of pages any student reads.

Input

n k, then n page counts.

Output

A number.

Sample 1

Input
4 2
12 34 67 90
Output
113

Sample 2

Input
1 1
5
Output
5
solution.py
Output appears here
Split the Pages · Python Arena problem · LearnPy Hub