#include <iostream>
using namespace std;
int n;
const int N=2*100000+50;
int a[N];
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
int n1,s;
cin>>n1>>s;
for(int j=0;j<n1;j++)
{
cin>>a[j];
}
int ans=0;
int len=N;
for(int j=0,l=0;j<n1;j++)
{
ans+=a[j];
while (ans>=s)
{
len=min(len,j-l+1);
ans-=a[l];
l++;
}
}
if(len==N)
{
cout<<0<<endl;
}
else
{
cout<<len<<endl;
}
}
return 0;
}
双指针的核心就是怎么枚举右端点,用一个for循环枚举就可以