#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } #include #include using Modint = atcoder::static_modint<998244353>; using namespace std; void testcase(){ i64 N, M; cin >> N >> M; vector D(N); rep(i,N) cin >> D[i]; vector Inv(M+1); for(i64 i=1; i<=M; i++) Inv[i] = Modint(M/i).inv(); Modint ans = 0; Modint mult = 1; for(auto a : D) mult *= M/a; reverse(D.begin(), D.end()); i64 BORDER = 200; for(i64 d=1; d<=min(BORDER,M); d++){ vector A(M+1); for(i64 i=1; i*d<=M; i++) A[i*d] += Inv[d]; rep(i,M) A[i+1] += A[i]; vector B(M+1); for(i64 j=d; j<=M; j++){ for(i64 i=1; i*j<=M; i++) B[j] += A[i*j-1]; B[j] *= Inv[j]; } vector C(M+1); for(i64 j=d; j<=M; j++){ for(i64 i=1; i*j<=M; i++) C[j] += A[i*j]; C[j] *= Inv[j]; } Modint t = 0; Modint c0 = 0; Modint c1 = 0; rep(i,N){ if(D[i] == d){ ans += c0 - t; c1 += 1; c0 += 1; t += C[D[i]]; } if(D[i] > d){ ans += c1 * B[D[i]]; c0 += 1; t += C[D[i]]; } } } atcoder::fenwick_tree ds(M+1); for(i64 d : D) if(d > BORDER){ for(i64 i=1; i*d<=M; i++) ans += ds.sum(0, i*d) * Inv[d]; for(i64 i=1; i*d<=M; i++) ds.add(i*d, Inv[d]); } ans *= mult; cout << ans.val() << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); rep(t,1) testcase(); return 0; }