mod=998244353 class fenwick_tree: def __init__(self, n, init=None): self.n = n self.tree = [0] * (n + 1) if init: for i in range(n): self.add(i, init[i]) def add(self, k, x): while k < self.n: self.tree[k] = (self.tree[k] + x) % mod k |= k + 1 def prefix_sum(self, i): s = 0 i -= 1 while i >= 0: s += self.tree[i] i = (i & (i + 1)) - 1 return s % mod def floor_sum(n, m, a, b): # sum [i = 0, ..., n-1] floor((ai+b)/m) ans = 0 while True: ans += (n - 1) * n * (a // m) // 2 a %= m ans += n * (b // m) b %= m y = (a * n + b) // m x = y * m - b if y == 0: return ans ans += (n - (x + a - 1) // a) * y n, m, a, b = y, a, m, (-x) % a n,m=map(int,input().split()) inv=[0]+[pow(i,mod-2,mod)for i in range(1,m+1)] d=list(map(int,input().split())) B=100 cnt=[] cnt1=[[0]*(m+1)for i in range(B+1)] cnt2=[[0]*(m+1)for i in range(B+1)] for i in range(2): cnt=[0]*(B+1) for e in d: if e>B or i==0: for j in range(1,B+1): cnt1[j][e]+=cnt[j] cnt1[j][e]%=mod if e<=B: cnt[e]+=1 d.reverse() cnt1,cnt2=cnt2,cnt1 ans=0 ft=fenwick_tree(m+1) for e in d: if e<=B:continue for i in range(e,m+1,e): ans+=(ft.prefix_sum(m+1)-ft.prefix_sum(i+1))*inv[m//e] ft.add(i,inv[m//e]) for i in range(1,B+1): for j in range(1,m+1): if cnt1[i][j]: ans+=inv[m//i]*inv[m//j]%mod*cnt1[i][j]%mod*floor_sum(m//i,j,i,i-1)%mod if cnt2[i][j]: ans+=inv[m//i]*inv[m//j]%mod*cnt2[i][j]%mod*floor_sum(m//j,i,j,j-1)%mod for e in d: ans*=m//e ans%=mod print(ans)