#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ long long N,K; cin>>N>>K; map dp; dp[1] = 1; rep(i,N){ long long a; cin>>a; map ndp; for(auto A:dp){ ndp[gcd(A.first * gcd(a,K),K)] += A.second; ndp[A.first] += A.second; } swap(dp,ndp); } dp[1]--; cout<