#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL 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); } }; combi C(2000000); mint get(vector a,int N){ sort(a.begin(),a.end()); vector cnt(N+1); for(int i=1;i<=N;i++){ cnt[i] = distance(lower_bound(a.begin(),a.end(),i),a.end()); } vector dp(N+1,vector(N+1,0)); dp[0][0] = 1; for(int i=N;i>=1;i--){ for(int j=N;j>=0;j--){ rep(k,N+1){ if(k*i>N)break; int rem = cnt[i] - k; if(rem<0)break; for(int l=1;l<=N;l++){ if(remN)break; if(j+l*i>N)break; mint v = dp[j][k]; v *= C.combination(rem,l); v *= C.kaijou_[i].pow(l); v *= C.kaijou[i*l]; v *= C.combination(N-j, i*l); dp[j+l*i][k+l] += v; } } } } mint ret = 0; rep(i,N+1){ ret += dp[N][i]; } return ret; } int main(){ int N,K; cin>>N>>K; vector aa(N); rep(i,N){ cin>>aa[i]; } //cout< cnt; for(int i=1;i<=K;i++){ int g = gcd(i,K); cnt[K/g]++; } mint ans = 0; for(auto a:cnt){ vector b = aa; rep(i,N){ b[i] /= a.first; } mint ret = get(b,K/a.first); ret *= a.second; ans += ret; } ans /= K; cout<