#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,150); 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-a0+i-1)/i; cnt[i][j] = floor_sum(n,m,i,a0); cnt[i][j] /= mint(M/i) * mint(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 for(int j=a[i];j<=M;j+=a[i]){ ans += fw.sum(j+1,M+1)/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,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-a0+j-1)/j; cnt[i][j] = floor_sum(n,m,j,a0); cnt[i][j] /= mint(M/j) * mint(M/i); } } 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<