#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 int main(){ int N,M; cin>>N>>M; int B = min(M,300); vector is(M+5); rep(i,M+5){ if(i==0)continue; is[i] = mint(i).inv(); } vector cnt(B+1,vector(M+1)); for(int i=1;i<=B;i++){ for(int j=1;j<=M;j++){ int a0 = i-1; int m = j; int n = M/i; cnt[i][j] = floor_sum(n,m,i,a0); cnt[i][j] *= is[M/i] * is[M/j]; } } vector num(B+1); vector a(N); rep(i,N)scanf("%d",&a[i]); fenwick_tree fw(M+1); mint ans = 0; rep(i,N){ //small, * for(int j=1;j<=B;j++){ ans += num[j] * cnt[j][a[i]]; } //big big if(a[i]>B){ for(int j=a[i];j<=M;j+=a[i]){ ans += fw.sum(j+1,M+1)*is[M/a[i]];//mint(M/a[i]); } } if(a[i]<=B)num[a[i]]++; else{ for(int j=a[i];j<=M;j+=a[i]){ fw.add(j,is[M/a[i]]);//mint(M/a[i]).inv()); } } } num.assign(B+1,0); reverse(a.begin(),a.end()); for(int i=1;i<=B;i++){ for(int j=1;j<=M;j++){ int a0 = j-1; int m = i; int n = M/j; cnt[i][j] = floor_sum(n,m,j,a0); cnt[i][j] *= is[M/i] * is[M/j];//mint(M/i) * mint(M/j); } } rep(i,N){ //big, small if(a[i]>B){ for(int j=1;j<=B;j++){ ans += num[j] * cnt[j][a[i]]; } } else num[a[i]]++; } rep(i,N)ans *= mint(M/a[i]); cout<