### My issue

The subtasks are failing. I am not able to figure it out why?

### My code

```
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long int T,N,K;
cin>>T;
while(T--)
{
cin>>N>>K;
long long int A[N];
for(int i=0;i<N;i++) cin>>A[i];
//------------------------------
long long int freq[N];
for(int i=0;i<N;i++) freq[i]=0;
for(int i=0;i<N;i++)
{
if(A[i]==i+1) continue;
else
{
freq[A[i]-1]++;
}
}
long long int count=0;
for(int i=0;i<N;i++)
{
if(freq[i]>=K) count++;
}
cout<<count<<endl;
}
return 0;
}
```

Problem Link: STUDVOTE Problem - CodeChef