```
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
cin>>n;
while(n--)
{
ll x[10];
ll ps[10]={0};
ll g,p;
cin>>g>>p;
for(int i=0;i<10;i++){
cin>>x[i];
}
reverse(x, x + 10);
ps[0]=x[0];
for(int i=1;i<10;i++){
ps[i]=ps[i-1]+x[i];
}
ll res,rt;
ll exc=0,t,remain;
if(g==10)
{
res=ps[0]/p;
remain=ps[0]-p;
ll cnt=0;
if(remain%p!=0){
cnt=1;
}
while(remain>p && remain%p!=0){
remain=remain-p;
cnt++;
}
cout<<res<<" "<<res+cnt<<"\n";
return 0;
}
res=(ps[10-g-1])/p;
remain=ps[10-g-1]%p;
remain+=x[10-g];
ll cnt=0;
while(remain>p && remain%p!=0){
remain=remain-p;
cnt++;
}
cout<<res+1<<" "<<res+cnt+1<<"\n";
}
}
```

Where i am wrong?any help/edits will be appreciated, Thanks in advance