Məsələlər
Minimal Subarray Length
Minimal Subarray Length
You are given an integer sequence of length \textbf{N} and another value \textbf{X}.
You have to find a contiguous subsequence of the given sequence such that the sum is greater or equal to \textbf{X}. And you have to find that segment with minimal length.
\InputFile
First line of the input file contains \textbf{T} the number of test cases. Each test case starts with a line containing \textbf{2} integers \textbf{N }(\textbf{1} ≤ \textbf{N} ≤ \textbf{500000}) and \textbf{X} (\textbf{-10^9} ≤ \textbf{X} ≤ \textbf{10^9}). Next line contains \textbf{N} integers denoting the elements of the sequence. These integers will be between \textbf{-10^9} to \textbf{10^9} inclusive.
\OutputFile
For each test case output the minimum length of the sub array whose sum is greater or equal to \textbf{X}. If there is no such array, output \textbf{-1}.
Giriş verilənləri #1
3 5 4 1 2 1 2 1 6 -2 -5 -6 -7 -8 -9 -10 5 3 -1 1 1 1 -1
Çıxış verilənləri #1
3 -1 3