Today I was solving the problem on Codechef <https://www.codechef.com/problems/CHPINTU> here i get the Run time Error sigsegv below is the code please help me .Below is the C++ code

```cpp
    while(t!=0){
        int n,m;
        cin>>n>>m;
        int f[n],p[n];

        for(int i=0;i<n;i++)
            cin>>f[i];
        for(int i=0;i<n;i++)
            cin>>p[i];

        int freq[m+1];
        bool avail[m+1];
        memset(avail,false,sizeof(avail));
        memset(freq,-1,sizeof(freq));

        for(int i=0;i<n;i++){
            freq[f[i]]+=p[i];
            avail[f[i]]=true;

        }
        int min = INT_MAX;
        for(int i=0;i<=m;i++){
            if(freq[i]<min && avail[i]==true){
                min=freq[i];
            }
        }
        cout<<min<<"\n";
        t--;
    }

```