#include <bits/stdc++.h>using namespace std;
constexpr int N = 200000 + 1, P = 998244353;
int a[N];
void solve() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
auto getprms = [](int x) {
vector<int> res;
for (int i = 2; i * i <= x; ++i) if (x % i == 0) {
x /= i;
res.push_back(i);
while (x % i == 0) {
x /= i;
}
}
if (x != 1) {
res.push_back(x);
}
return res;
};
int ans = 1;
for (int i = 2; i <= n; ++i) {
if (a[i - 1] % a[i]) {
cout << "0\n";
return ;
}
vector<int> res = getprms(a[i - 1] / a[i]);
int sm = 0;
auto dfs = [&](auto &&self, int dep, int mul, int mu) {
if (dep == (int)res.size()) {
sm += m / a[i] / mul * mu;
return ;
}
self(self, dep + 1, mul, mu);
self(self, dep + 1, mul * res[dep], -mu);
};
dfs(dfs, 0, 1, 1);
ans = (long long)ans * sm % P;
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}