CSES Coin combination 1 problem

why does my solution is getting run time error
here the question-CSES - Coin Combinations II
code-"
#include <bits/stdc++.h>
using namespace std;
#define ndl “\n”
#define rep(i, n) for (int i = 0; i < n; i++)
#define lli long long int
#define mod 1000000007
#define jaldi
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#define test
lli t;
cin >> t;
while (t–)
lli dp[103][1000003];
int coincoII(int a[],int n,int x){
if(x==0)return 1;
else if(n==0||x<a[0])return 0;
else if(dp[n][x]==-1){
dp[n][x]=0;
dp[n-1][x]=coincoII(a,n-1,x);
if(x>=a[n-1]){
dp[n][x-a[n-1]]=coincoII(a,n,x-a[n-1]);
dp[n][x]=dp[n-1][x]%mod+dp[n][x-a[n-1]]%mod;
dp[n][x]=dp[n][x]%mod;
return dp[n][x];
}else{
dp[n][x]=dp[n-1][x]%mod;
return dp[n][x];
}
}
return dp[n][x];
}
int main()
{
jaldi
int n,x;
cin>>n>>x;
int a[n];
rep(i,n)cin>>a[n];
sort(a,a+n);
memset(dp,-1,sizeof(dp));
cout<<coincoII(a,n,x);
}