#include #include using namespace std; using mint = atcoder::modint1000000007; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; long long K; cin >> N >> K; map dp; bool fn = false; dp[1] = 1; while (N--) { auto ep = dp; long long A; cin >> A; if (A % K != 0) fn = true; A = gcd(A, K); for (auto [key, val] : dp) { ep[gcd(key * A, K)] += val; } dp = ep; } if (!fn && K == 1) dp[K]--; cout << dp[K].val() << endl; }