You are given n positive integers and a budget S. Find the maximum length of a contiguous subarray whose sum is at most S. Print 0 if no single element fits.
The first line has n and S. The second line has n positive integers.
Print one integer: the maximum length.
1 <= n <= 200000 1 <= a_i <= 10^9 1 <= S <= 10^15
1000 ms256 MB
6 10 2 3 1 4 1 2
4
2+3+1+4 = 10 has length 4. No window of length 5 has sum at most 10.