#include using namespace std; typedef long long ll; static const int MAX = 100001; bool isPrime[MAX]; void aryPrime() { for (int i = 0; i < MAX; i++) { isPrime[i] = true; } isPrime[0] = false; isPrime[1] = false; int n = sqrt(MAX); for (int i = 2; i <= n; i++) { if (!isPrime[i]) continue; for (int j = i * 2; j < MAX; j += i) { isPrime[j] = false; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; int m = sqrt(N); vector p; aryPrime(); for (int i = 2; i < N; i++) { if (isPrime[i]) { p.push_back(i); } } int dp[N]; for (int i = 0; i < N; i++) { dp[i] = 1; } vector s; for (int i = 2; i <= m; i++) { int t = N; if (t % i == 0) { s.push_back(i); while (t % i == 0) { t /= i; } } } for (int i = 1; i < N; i++) { int t = i; for (int j : p) { int cnt = 0; while (t % j == 0) { t /= j; cnt++; } dp[i] *= (cnt + 1); } } int g = 0; int ans = 0; for (int i = 1; i < N; i++) { int cnt = 0; int t = i; int n = N; for (int j : s) { while (t % j == 0 && n % j == 0) { t /= j; n /= j; cnt++; } } if (cnt >= K && g < dp[i]) { g = dp[i]; ans = i; } } cout << ans << "\n"; return 0; }