#include using namespace std; #define ll long long #define repname(a, b, c, d, e, ...) e #define rep(...) repname(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__) #define rep0(x) for (int rep_counter = 0; rep_counter < (x); ++rep_counter) #define rep1(i, x) for (int i = 0; i < (x); ++i) #define rep2(i, l, r) for (int i = (l); i < (r); ++i) #define rep3(i, l, r, c) for (int i = (l); i < (r); i += (c)) #include #include #include using namespace atcoder; using mint = modint998244353; int B = 100; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; vector D(N); rep(i, N) cin >> D[i]; vector I(M + 1); rep(i, 1, M + 1) I[i] = mint(M / i).inv(); vector> cnt1(M + 1, vector(B + 1, 0)), cnt2(B + 1, vector(M + 1, 0)); vector c(B + 1, 0); rep(i, N) { rep(j, 1, B + 1) cnt1[D[i]][j] += c[j]; if (D[i] <= B) c[D[i]]++; } c.assign(M + 1, 0); fenwick_tree ft(M + 1); mint ans = 0; for (int i = N - 1; i >= 0; i--) { if (D[i] > B) { rep(j, 1, B + 1) cnt2[j][D[i]] += c[j]; rep(j, D[i], M + 1, D[i]) ans += ft.sum(0, j) * I[D[i]]; rep(j, D[i], M + 1, D[i]) ft.add(j, I[D[i]]); } else c[D[i]]++; } rep(i, 1, M + 1) { rep(j, 1, B + 1) { if (cnt1[i][j] != 0) { ans += cnt1[i][j] * (mint)floor_sum(M / j, i, j, j - 1) * I[i] * I[j]; } } } rep(i, 1, B + 1) { rep(j, 1, M + 1) { if (cnt2[i][j] != 0) { ans += cnt2[i][j] * (mint)floor_sum(M / j, i, j, j - 1) * I[i] * I[j]; } } } rep(i, N) ans *= M / D[i]; cout << ans.val() << endl; }