/** author: shobonvip created: 2024.10.25 22:20:13 **/ #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector d(n); rep(i,0,n){ cin >> d[i]; } mint alls = 1; rep(i,0,n){ alls *= mint(m / d[i]); } vector e(m+1); rep(i,1,m+1){ e[i] = mint(m / i).inv(); } mint ans = 0; int mx = min(m, 200); rep(num,1,mx+1) { vector cnt(m+1); rep(i,1,m+1){ cnt[i] = cnt[i-1] + (i%num==0); } vector riba(m+1); vector jun(m+1); rep(i,1,m+1){ for (int j=i; j<=m; j+=i){ jun[i] += cnt[j-1]; riba[i] += cnt[m] - cnt[j]; } } mint tmp = 0; mint tmp_jun = 0; rep(i,0,n){ if(d[i] <= mx) { ans += tmp * e[d[i]] * riba[d[i]]; }else{ tmp_jun += e[d[i]] * jun[d[i]]; ans += tmp * e[d[i]] * riba[d[i]]; } if(d[i] == num) { ans += tmp_jun * e[num] * alls; tmp += e[num] * alls; } } } vector bucket(m+1, vector(0)); rep(i,0,n){ if(d[i] > mx){ for (int j=d[i]; j<=m; j+=d[i]){ bucket[j].push_back(i); } } } fenwick_tree fw(n); rep(i,1,m+1){ for (int j: bucket[i]){ ans += fw.sum(j+1, n) * e[d[j]] * alls; fw.add(j, e[d[j]]); } } cout << ans.val() << '\n'; }