```
using namespace std;
int main(){
int n,k,t;
cin>>t;
while(t--){
cin>>n>>k;
int a[n];
int sum=0,ans=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
if(a[i]>k)
{
ans=-1;
break;
}
// if(sum==k)
// {
// ans++;
// sum=0;
// }
if(sum>k)
{
ans++;
sum=a[i];
}
}
//
if(ans==-1)
cout<<-1<<endl;
else
{
if(sum>0)
cout<<ans+1<<endl;
else cout<<ans<<endl;
}
}
}
```

why is my code not getting accepted