#include using namespace std; using ll = long long; bool is_prime(int n) { if (n % 2 == 0) return false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return n != 1; } vector divisor(int n) { vector res; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { res.emplace_back(i); if (i != n / i) res.emplace_back(n / i); } } return res; } map prime_factor(int n) { map res; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } vector sieve(int n) { vector res; vector is_prime(n + 1, true); is_prime[0] = false; is_prime[1] = false; for (int i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.emplace_back(i); for (int j = 2 * i; j <= n; j += i) is_prime[j] = false; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, K; cin >> n >> K; map memo = prime_factor(n); int max_num = 0; int ans = 0; for (int i = 1; i <= n; i++) { map memo2 = prime_factor(i); int cnt = 0; for (auto& p : memo) { if (memo2.find(p.first) == memo2.end()) continue; cnt += min(p.second, memo2[p.first]); } if (cnt < K) continue; int num = 1; for (auto& p : memo2) { num *= (p.second + 1); } if (max_num < num) { max_num = num; ans = i; } } cout << ans << endl; return 0; }