#include using namespace std; using ll = long long; const ll MOD = 1000000007; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ ll n,k,k2,foc = 0; cin >> n >> k; if(k==1){ ll ans = 1; rep(i,n) ans = ans * 2 % MOD; cout << (ans - 1 + MOD) % MOD << endl; return 0; } k2 = k; vector> dp; vector div; vector siz; for(ll i=2;i*i<=k;i++){ if(!(k2%i)){ div.push_back(i); siz.push_back(1); dp.push_back({1}); while(!(k2%i)){ k2 /= i; dp[foc].push_back(0); siz[foc]++; } foc++; } } if(k2!=1){ div.push_back(k2); siz.push_back(2); dp.push_back({1,0}); foc++; } rep(i,n){ ll a; cin >> a; rep(j,foc){ int cnt = 0; while(!(a%div[j])){ cnt++; a /= div[j]; } if(!cnt) continue; for(int k=siz[j]-1;k>=0;k--){ int update = min(k+cnt, siz[j]-1); dp[j][update] = (dp[j][update]+dp[j][k]) % MOD; } } } ll ans = 1; rep(i,foc) ans = ans * dp[i][siz[i]-1] % MOD; cout << ans << endl; return 0; }