#D3018. Allocation

    ID: 2514 Type: Default 1000ms 134MiB

Allocation

Allocation

You are given nn packages of wiw_i kg from a belt conveyor in order (i=0,1,...n1i = 0, 1, ... n-1). You should load all packages onto kk trucks which have the common maximum load PP. Each truck can load consecutive packages (more than or equals to zero) from the belt conveyor unless the total weights of the packages in the sequence does not exceed the maximum load PP.

Write a program which reads nn, kk and wiw_i, and reports the minimum value of the maximum load PP to load all packages from the belt conveyor.

Constraints

  • 1n100,0001 \leq n \leq 100,000
  • 1k100,0001 \leq k \leq 100,000
  • 1wi10,0001 \leq w_i \leq 10,000

Input

In the first line, two integers nn and kk are given separated by a space character. In the following nn lines, wiw_i are given respectively.

Output

Print the minimum value of PP in a line.

Examples

Input

5 3 8 1 7 3 9

Output

10

Input

4 2 1 2 2 6

Output

6

inputFormat

Input

In the first line, two integers nn and kk are given separated by a space character. In the following nn lines, wiw_i are given respectively.

outputFormat

Output

Print the minimum value of PP in a line.

Examples

Input

5 3 8 1 7 3 9

Output

10

Input

4 2 1 2 2 6

Output

6

样例

5 3
8
1
7
3
9
10