#line 1 "main.cpp" #include #include // #include "library/templates/template.hpp" using namespace atcoder; using namespace std; using ll = long long int; vector divisor(ll n) { vector ret; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(begin(ret), end(ret)); return (ret); } using mint = modint1000000007; long long solve(int N, long long K, const std::vector &A) { auto divK = divisor(K); // cerr << divK << endl; map mpK; vector vK; for (ll x : divK) { mpK[x] = vK.size(); vK.push_back(x); } mpK[0] = mpK[K]; vector dp(vK.size()); dp[0] = 1; for (int i = 0; i < N; i++) { vector nxtdp = dp; // ll g = gcd(K, A[i]); for (int x = 0; x < vK.size(); x++) { ll k = vK[x]; k *= A[i]; k = gcd(k, K); int y = mpK[k]; nxtdp[y] += dp[x]; } swap(dp, nxtdp); } return dp[mpK[K]].val(); } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int N; long long K; std::cin >> N >> K; std::vector A(N); for (int i = 0; i < N; ++i) { std::cin >> A[i]; A[i] %= K; } auto ans = solve(N, K, A); std::cout << ans << '\n'; return 0; }