int getSolMem(int i, int mul, vector<int>& a, int n, int p, vector<vector<int>>& dp) {
if (mul > p) {
return 0;
}
if (i == n) {
return 1;
}
if (dp[i][mul] != -1) {
return dp[i][mul];
}
int include = getSolMem(i + 1, mul * a[i], a, n, p, dp);
int exclude = getSolMem(i + 1, mul, a, n, p, dp);
return dp[i][mul] = (include + exclude) % mod;
}
// Now applying the tabulation to above problem
int countSubsequences(vector<int>& a, int n, int p) {
// vector<vector<int>> dp(n, vector<int>(p + 1, -1));
// return (getSolMem(0, 1, a, n, p, dp) - 1 + mod) % mod;
return solveTab(1,a,n,p);
}