getting WA in CLPERM. can anyone help me.here is my code.

#include
#include
using namespace std;
int main()
{
long long t,n,k,a[100001];

cin>>t;
while(t--)
{
    cin>>n;
    
    long long sum1=0;
    sum1=n*(n+1)/2;
    
    cin>>k;
    long long sum=0,flag=1,c=0;
    
    long long sum2=0;

    for(int i=0;i<k;i++)
    {
        cin>>a[i];
    }

    sort(a,a+k);
    
    for(int i=0;i<k;i++)

      {

        sum=sum+a[i];

        sum2=((a[i]+1)*a[i])/2-sum;

        if(sum2<0)
        {
            flag=0;
            c=a[i];
            break;
        }


    }

    if(flag==0)
    {
        if(c%2==0)
            cout<<"Mom"<<endl;
        else
            cout<<"Chef"<<endl;
    }
    else
    {
        if((sum1-sum)%2==0)
            cout<<"Chef"<<endl;
        else
            cout<<"Mom"<<endl;

    }

}

}

Check your answer for N=10 and K=5 and K values being 4,5,6,7,9.Your answer will differ from the actual answer…