The following code gives NZEC error, I am not able to figure out why. Somebody please help.
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
if(t>100 || t<1) return 1;
while(t--)
{
int n,m;
cin>>n>>m;
if(n>100 || n<1) return 1;
if(m>10000 || m<1) return 1;
int a[n]; int max=1;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]>100 || a[i]<1) return 1;
if(a[i]>max) max=a[i];
}
int sum=0;
for(int i=0;i<n;i++)
{
while(a[i]!=max)
{
a[i]=a[i]+1;
sum++;
}
}
if(sum>m)
cout<<"No"<<endl;
else if(sum<m)
{
if((m-sum)%n==0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
else
cout<<"Yes"<<endl;
}
return 0;
}