#include #define rep(i, l, r) for (int i = (l); i < (r); i++) using namespace std; typedef long long ll; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { int N, K; cin >> N >> K; vector A(N); rep(i, 0, N) cin >> A[i]; vector> dp(N + 1); dp[0][1] = 1; ll MOD = 1000000007; rep(i, 0, N) { for (auto j : dp[i]) { dp[i + 1][j.first] = (dp[i + 1][j.first] + j.second) % MOD; ll x = gcd(j.first * gcd(A[i], K), K); dp[i + 1][x] = (dp[i + 1][x] + j.second) % MOD; } } ll ans = 0; for (auto i : dp[N]) { if (i.first % K == 0) ans = (ans + i.second) % MOD; } if (K == 1) ans--; cout << ans << endl; /* rep(i, 0, N + 1) { for (auto j : dp[i]) { cout << "(" << j.first << "," << j.second << ")"; } cout << endl; } */ }