Help me in solving PERMSUBSEQ problem coming wrong answer

Here is the code
include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t–){
long long n;
cin>>n;
vectora(n);
vectorb(200002);
vectorp(200002);
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(a[i]<=200000){
b[a[i]]++;
}
}
p[0]=1;
long long count =0;
for(int i=1;i<=200000;i++){
p[i]=(b[i]*p[i-1])%1000000007;
count+=(p[i])%1000000007;
}
cout<<count<<endl;
}
return 0;
}
Here is the solution Link:CodeChef: Practical coding for everyone
I used the prefix sum method and modulo method but getting wrong answer and TLE

@whitepalace
to remove tle just iterate till n it will do the job and wa u r getting may be because of count+= statement just do it as count =(count + p[i])%mod;
rest i think your logic is correct i have done the same thing.