Cords
InterviewTime limit1sMemory limit128 MB
Partition the row of cords into the maximum number of contiguous groups with total length at least w.
Statement
Jaś received cords from his grandfather and laid them out in a straight line, one next to another. Any two adjacent cords can be joined into a single cord whose length equals the sum of the two lengths. A cord formed this way can be joined again with an adjacent cord.
Jaś wants every cord he is left with to be at least as long as his own height , while keeping as many cords as possible. Because only adjacent cords may be joined, each final cord is the concatenation of a contiguous block of the original cords.
Find the maximum number of cords Jaś can end up with. If joining all of the cords into one still gives a length shorter than , then no valid arrangement exists, so output .
Input
The first line contains two integers and (), the number of cords and Jaś's height.
The second line contains integers (), the lengths of the cords from left to right.
Output
Print a single integer: the maximum number of cords Jaś can obtain, where every cord has length at least .