#include using namespace std; #define REP(i,n) for (int i=0;i<(n);i++) #define REP2(i,m,n) for (int i=m;i<(n);i++) typedef long long ll; const ll MOD = 1000000007; ll N, K; ll A[2020]; map, ll> dp[2]; void solve() { cin >> N >> K; REP(i, N) cin >> A[i]; if (K == 1) { ll ans = 1; REP(i, N) ans = ans * 2 % MOD; ans = (ans - 1 + MOD) % MOD; cout << ans << endl; return; } map D; for (ll i = 2; i * i <= K; ++i) { while (K % i == 0) D[i] += 1, K /= i; } if (K > 1) D[K] += 1; vector keys; vector vals; for (const auto &item : D) { keys.push_back(item.first); vals.push_back(item.second); } vector y; REP(i, keys.size()) y.push_back(0); dp[0][y] = 1; int cur = 0, tar = 1; REP(i, N) { dp[tar].clear(); for (auto hoge = begin(dp[cur]); hoge != end(dp[cur]); ++hoge) { dp[tar][hoge->first] = hoge->second; } vector x; for (const auto &item : D) { ll tmp = 0; while (A[i] % item.first == 0) tmp++, A[i] /= item.first; x.push_back(tmp); } for (auto hoge = begin(dp[cur]); hoge != end(dp[cur]); ++hoge) { REP(j, keys.size()) y[j] = min(x[j] + hoge->first[j], vals[j]); (dp[tar][y] += hoge->second) %= MOD; } swap(cur, tar); } cout << dp[cur][vals] << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); }