#include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) struct combi{ deque kaijou; deque kaijou_; combi(int n){ kaijou.push_back(1); for(int i=1;i<=n;i++){ kaijou.push_back(kaijou[i-1]*i); } mint b=kaijou[n].inv(); kaijou_.push_front(b); for(int i=1;i<=n;i++){ int k=n+1-i; kaijou_.push_front(kaijou_[0]*k); } } mint combination(int n,int r){ if(r>n)return 0; mint a = kaijou[n]*kaijou_[r]; a *= kaijou_[n-r]; return a; } mint junretsu(int a,int b){ mint x = kaijou_[a]*kaijou_[b]; x *= kaijou[a+b]; return x; } mint catalan(int n){ return combination(2*n,n)/(n+1); } }; int main() { int N,K; cin>>N>>K; vector y; for(long long i=1;i*i<=K;i++){ if(K%i==0){ y.push_back(i); if(i*i!=K)y.push_back(K/i); } } sort(y.begin(),y.end()); vector c(y.size()); rep(i,N){ long long a; cin>>a; a = gcd(a,K); c[distance(y.begin(),lower_bound(y.begin(),y.end(),a))]++; } vector dp(y.size()); dp.back() = 1; combi C(1000000); rep(i,y.size()){ vector cnt(30); vector v(30); long long cur = 1; rep(j,c[i]+1){ cnt[min(29,j)] += C.combination(c[i],j); v[j] = cur; cur *= y[i]; cur = gcd(cur,K); } vector ndp(y.size()); rep(j,y.size()){ rep(k,30){ int d = distance(y.begin(),lower_bound(y.begin(),y.end(),y[j] / gcd(y[j],v[k]))); ndp[d] += dp[j] * cnt[k]; } } swap(dp,ndp); } cout<