Minimal Subarray Length
Very easy
Execution time limit is 3 seconds
Runtime memory usage limit is 128 megabytes
You are given an integer sequence of length N and another value X.
You have to find a contiguous subsequence of the given sequence such that the sum is greater or equal to X. And you have to find that segment with minimal length.
Input
First line of the input file contains T the number of test cases. Each test case starts with a line containing 2 integers N (1 ≤ N ≤ 500000) and X (-10^9 ≤ X ≤ 10^9). Next line contains N integers denoting the elements of the sequence. These integers will be between -10^9 to 10^9 inclusive.
Output
For each test case output the minimum length of the sub array whose sum is greater or equal to X. If there is no such array, output -1.
Examples
Input #1
Answer #1
Submissions 213
Acceptance rate 34%