- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a cyclic array consisting of values. Each element has two neighbors; the elements at positions and are also considered neighbors.
Your task is to divide the array into subarrays so that the sum of each subarray is at most . What is the minimum number of subarrays?
Input
The first input line contains integers and .
The next line has integers : the contents of the array.
There is always at least one division (i.e., no value in the array is larger than ).
Output
Print one integer: the minimum number of subarrays.
Constraints
Example
Input:
8 5 2 2 2 1 3 1 2 1
Output:
3
Explanation: We can create three subarrays: , , and (remember that the array is cyclic).