1 /*
2 * File: B.cpp
3 * Author: GongZhi
4 * Problem:
5 * Created on 2009年7月27日, 上午9:07
6 */
7
8 #include <stdlib.h>
9 #include <string.h>
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 #include <map>
14 #include <queue>
15 using namespace std;
16
17 /*
18 *
19 */
20 int a[110000];
21
22 int main() {
23 int i, j,t,ans;
24 int n, s;
25 int kase;
26 scanf("%d",&kase);
27 while (kase--) {
28 scanf("%d%d", &n, &s);
29 ans=n+1;
30 for (i = 0; i < n; i++)scanf("%d", &a[i]);
31 i=0;j=0;t=0;
32 while(j<n){
33 t+=a[j++];
34 while(i<=j && t-a[i]>=s){
35 t-=a[i];
36 i++;
37 }
38 if(t>=s && j-i<ans)ans=j-i;
39 }
40 if(ans==n+1)printf("0\n");
41 else printf("%d\n",ans);
42 }
43 return 0;
44 }
45