#D3018. Allocation
Allocation
Allocation
You are given packages of kg from a belt conveyor in order (). You should load all packages onto trucks which have the common maximum load . 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 .
Write a program which reads , and , and reports the minimum value of the maximum load to load all packages from the belt conveyor.
Constraints
Input
In the first line, two integers and are given separated by a space character. In the following lines, are given respectively.
Output
Print the minimum value of 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 and are given separated by a space character. In the following lines, are given respectively.
outputFormat
Output
Print the minimum value of 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