Time limit
0.5s
Memory limit
128 MB
You are given a sequence of length N. Every element is a positive integer no greater than 10,000.
Among all nonempty contiguous subsequences whose sum is at least S, find the length of the shortest one.
The first line contains two integers N and S separated by a space. (10 <= N < 100,000, 0 < S <= 100,000,000)
The second line contains the N elements of the sequence separated by spaces. Each element is a positive integer no greater than 10,000.
Print the minimum length of a contiguous subsequence whose sum is at least S. If no such subsequence exists, print 0.