eolymp
bolt
Try our new interface for solving problems
Problems

Minimal Subarray Length

Minimal Subarray Length

Time limit 3 seconds
Memory limit 128 MiB

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 data

First line of the input file contains T the number of test cases. Each test case starts with a line containing 2 integers N (1N500000) and X (-10^9X10^9). Next line contains N integers denoting the elements of the sequence. These integers will be between -10^9 to 10^9 inclusive.

Output data

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 example #1
3
5 4
1 2 1 2 1
6 -2
-5 -6 -7 -8 -9 -10
5 3
-1 1 1 1 -1
Output example #1
3
-1
3
Author Dr. Abdullah al Mahmud
Source ACM-ICPC Asia Phuket Regional Programming Contest 2013, 22 November 2013