Suffering
View as PDFJosh does not like research. He models the FIT2083 classes of the semester as an array, where
is the number of Depression Points he gains from attending the
th class.
If the total number of Depression Points from a consecutive block of classes becomes strictly
greater than , Josh will die. Determine the smallest number of consecutive classes he can
attend and die as a result. If no such block exists, output
-1.
Input
The first line contains two integers and
.
The second line contains positive integers
.
Output
Print a single integer: the minimum length of a contiguous subarray whose sum is strictly greater
than . If no such subarray exists, print
-1.
Constraints
Example 1
Input
5 11
5 10 1 4 5
Output
2
Explanation
The shortest valid subarray is , whose sum is
.
Comments