getting runtime error(SIGFPE)

#include<bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
long long int n,s;
cin>>n>>s;
long long int a[n];
sort(a,a+n);
long long int sum=0,flag=0;
for(int i=0;i<n;i++)
{
if((s-sum)/(a[i])==(n-i))
{
cout<<a[i]<<endl;
flag=1;
break;
}
else
{
sum+=a[i];
}
}
if(flag==0)
cout<< -1 <<endl;
}
return 0;
}

getting runtime error SIGFPE in this code
constrains are:
1 ≤ T ≤ 100
1 ≤ N ≤ 2*10^4
1 ≤ S ≤ 10^11
1 ≤ A[i] ≤ 10^5

we can’t help you as this is from ongoing contest.

//