#include #include #define pub push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i, n) rep2(i, 0, n) #define rep2(i, m, n) for (ll i = m; i < (n); i++) #define per(i, b) per2(i, 0, b) #define per2(i, a, b) for (ll i = int(b) - 1; i >= int(a); i--) #define ALL(c) (c).begin(), (c).end() using namespace std; using ll = long long; using Pll = pair; using namespace atcoder; using mint = modint998244353; using mint2 = modint1000000007; constexpr long long INF = (1LL << 60); constexpr double EPS = 1e-9; constexpr double PI = 3.141592653589; template bool chmax(T& a, const T& b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template bool chmin(T& a, const T& b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } template T sq(T x) { return x * x; } std::string zfill(int n, const int width) { std::stringstream ss; ss << std::setw(width) << std::setfill('0') << n; return ss.str(); } //多倍長整数を(string→vector)に変換 vector digit(string s) { ll n = s.size(); vector d(n); rep(i, n) { d[i] = s[i] - '0'; } return d; } //多倍長整数の足し算 vector adds(vector s, vector t) { ll n = s.size(); ll m = t.size(); if (n > m) { swap(s, t); n = s.size(); m = t.size(); } reverse(ALL(s)); reverse(ALL(t)); rep(i, m - n) { s.pub(0); } bool kuriage = false; rep(i, m) { ll a = s[i]; ll b = t[i]; ll c = a + b; if (kuriage) { c++; } if (c >= 10) { c -= 10; kuriage = true; } else { kuriage = false; } t[i] = c; } if (kuriage) { t.pub(1); } reverse(ALL(t)); return t; } vector carry_and_fix(vector digit) { int N = digit.size(); for (int i = 0; i < N - 1; ++i) { // 繰り上がり処理 (K は繰り上がりの回数) if (digit[i] >= 10) { int K = digit[i] / 10; digit[i] -= K * 10; digit[i + 1] += K; } // 繰り下がり処理 (K は繰り下がりの回数) if (digit[i] < 0) { int K = (-digit[i] - 1) / 10 + 1; digit[i] += K * 10; digit[i + 1] -= K; } } // 一番上の桁が 10 以上なら、桁数を増やすことを繰り返す while (digit.back() >= 10) { int K = digit.back() / 10; digit.back() -= K * 10; digit.push_back(K); } // 1 桁の「0」以外なら、一番上の桁の 0 (リーディング・ゼロ) を消す while (digit.size() >= 2 && digit.back() == 0) { digit.pop_back(); } reverse(ALL(digit)); return digit; } //多倍長整数の掛け算(s × t) 計算量は N(|s||t|)? vector mul(vector s, vector t) { reverse(ALL(s)); reverse(ALL(t)); ll NA = s.size(); ll NB = t.size(); vector res(NA + NB - 1); for (int i = 0; i < NA; ++i) { for (int j = 0; j < NB; ++j) { res[i + j] += s[i] * t[j]; } } return carry_and_fix(res); } /* make_is_prime(N) 入力:整数 N 出力:N までの数字が素数か判定したベクトル(i番目がtrueならiは素数) 計算量:O(nloglogn) */ vector< bool > prime_table(int n) { vector< bool > prime(n + 1, true); if (n >= 0) prime[0] = false; if (n >= 1) prime[1] = false; for (int i = 2; i * i <= n; i++) { if (!prime[i]) continue; for (int j = i + i; j <= n; j += i) { prime[j] = false; } } return prime; } /* divisor(n) 入力:整数 n 出力:nのすべての約数 計算量:O(√n) */ vector divisor(long long n) { vector ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(ret.begin(), ret.end()); // 昇順に並べる return ret; } int main() { //cout << fixed << setprecision(10); ll N, M; cin >> N >> M; vector A(N); vector cnt(M + 1); vector> d(M + 1); for (int i = 1; i <= M; i++) { d[i] = divisor(i); } rep(i, N) { cin >> A[i]; for (auto a : d[A[i]]) { cnt[a]++; } } vector ans(M + 1); for (int i = M; i >= 1; i--) { mint p = pow_mod(2, cnt[i], 998244353) - 1; ans[i] += p; for (auto a : d[i]) { if (a == i) { continue; } else { ans[a] -= ans[i]; } } } rep(i, M) { cout << ans[i + 1].val() << endl; } }