#include using namespace std; vector factorize(int N){ vector fs; for (int f = 2; f*f <= N; ++f){ while (N % f == 0){ fs.push_back(f); N /= f; } } if (N > 1) fs.push_back(N); return fs; } bool has_K_common_factors(int n, int K, const vector &fs){ for (auto f : fs){ if (n % f == 0){ n /= f; --K; } } return K <= 0; } int count_divisors(int n){ int n_div = 1; for (int f = 2; f*f <= n; ++f){ int c = 1; while (n % f == 0){ ++c; n /= f; } n_div *= c; } if (n > 1) n_div *= 2; return n_div; } int solve(int N, int K){ int max_n_div = 1; int ans = 1; auto fs = factorize(N); for (int i = 2; i < N; ++i){ if (has_K_common_factors(i, K, fs)){ int n_div = count_divisors(i); if (n_div > max_n_div){ ans = i; max_n_div = n_div; } } } return ans; } int main() { ios::sync_with_stdio(false); cout.tie(0); int N, K; cin >> N >> K; cout << solve(N, K) << endl; return 0; }