/** 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); rep(i,1,m+1){ for (int j=i; j<=m; j+=i){ riba[i] += cnt[m] - cnt[j]; } } mint tmp = 0; rep(i,0,n){ if(d[i] <= mx) { ans += tmp * e[d[i]] * riba[d[i]]; }else{ ans += tmp * e[d[i]] * riba[d[i]]; } if(d[i] == num) { 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'; }