#include #if __has_include() #include using namespace atcoder; #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using std::cin; using std::cout; using std::gcd; using std::map; using std::vector; using ll = long long; using mint = modint1000000007; int main() { int n, k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; map dp; dp[1] = 1; rep(i, n) { int ai = gcd(a[i], k); map p; swap(dp, p); rep(j, k+1) { dp[j] += p[j]; if (p[j] == 0) continue; ll g = gcd(j*ai, k); dp[g] += p[j]; } } mint ans = dp[k]; if (k == 1) ans -= 1; cout << ans.val() << '\n'; return 0; }