#include #include using namespace atcoder; #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using P = pair; using mint = modint1000000007; vector

factorize(int n) { vector

res; for (int i = 2; i*i <= n; ++i) { if (n%i != 0) continue; res.emplace_back(i, 0); while (n%i == 0) { n /= i; res.back().second++; } } if (n != 1) res.emplace_back(n, 1); return res; } int main() { int n, k; cin >> n >> k; map> mp; rep(i, n) { int a; cin >> a; auto fs = factorize(a); for (auto [p, x] : fs) mp[p].push_back(x); } mint ans = 1; for (auto [p, xs] : mp) { auto d = xs; ranges::sort(d, greater<>()); if (d.size() > k) d.resize(k); int cnt = 0; rep(i, d.size()) cnt += d[i]; ans *= mint(p).pow(cnt); } cout << ans.val() << '\n'; return 0; }