#include using namespace std; using ll = long long; const ll MOD = 998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, K; cin >> N >> K; vector A(N); int M = 1; for (auto &a : A) { cin >> a; M = max(M, a); } // 線形篩で最小素因数を求める vector spf(M + 1); vector primes; for (int i = 2; i <= M; i++) { if (spf[i] == 0) { spf[i] = i; primes.push_back(i); } for (int p : primes) { if (p > spf[i] || 1LL * p * i > M) break; spf[i * p] = p; } } // cnt[d] = dで割り切れるA_iの個数 // dは素数の累乗のみ vector cnt(M + 1, 0); for (int a : A) { int x = a; while (x > 1) { int p = spf[x]; int pw = 1; while (x % p == 0) { x /= p; pw *= p; cnt[pw]++; } } } // 素数冪が答えに含まれるための必要個数 int need = N - N / K + 1; ll ans = 1; for (int p : primes) { ll pw = p; while (pw <= M && cnt[pw] >= need) { ans = ans * p % MOD; pw *= p; } } cout << ans << '\n'; }