#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; vector v; //mapεž‹ #include template map prime_factor(T n) { map res; for (T i = 2; i * i <= n; i++) { bool f = false; while (n % i == 0) { f = true; res[i]++; n /= i; } if (f == true) v.push_back(i); } if (n != 1) { res[n]++; //nは素数 v.push_back(n); } return res; } // 𝑂(𝑁*log(log 𝑁)) vector eratosthenes(int N) { vector res; vector prime(N + 1, 1); prime[0] = prime[1] = false; for (int i = 2; i * i <= N; ++i) { if (prime[i] == true) { for (int j = 2 * i; j <= N; j += i) { prime[j] = false; } } } for (int i = 0; i <= N; ++i) { if (prime[i] == true) res.push_back(i); } return res; } int n, k; int main() { cin >> n >> k; auto p = prime_factor(n); queue que; int vs = v.size(); for (int i = 0; i < vs; i++) { que.push(v[i]); } map mp; for (int i = 0; i < k; i++) { int j = que.front(); que.pop(); p[j]--; if (p[j] > 0) que.push(j); mp[j]++; } int ans = 1; for (auto e : v) { for (int i = 0; i < mp[e]; i++) { ans *= e; } } //k個選んだ //cout << ans << endl; auto prime = eratosthenes(n); while (ans * 2 < n) { int m = 100, t = 1; for (int i = 0; i < prime.size() && prime[i] * ans < n; i++) { if (mp[prime[i]] < m) m = mp[prime[i]], t = prime[i]; } ans *= t; mp[t]++; } cout << ans << endl; }