#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; vectordev; vectorprdev; bool prime(ll n) { if (n == 1) { return false; } for (ll i = 2; i*i <= n; i++) { if (n%i == 0) { return false; } } return true; } void devisor(ll n) { for (ll i = 1; i*i <= n; i++) { if (n%i == 0) { if (i == n / i) { dev.push_back(i); } else { dev.push_back(i); dev.push_back(n / i); } } } } int po(int x, int y) { int ret = 1; rep(i, 0, y) { ret *= x; } return ret; } int dp[101010]; int main() { int n, k; cin >> n >> k; devisor(n); fore(i, dev) { if (prime(i)) { prdev.pb(i); } } fore(i, prdev) { int cnt = 0; int temp = n; while (temp > 0) { if (temp % i == 0)cnt++; else break; temp /= i; } for (int k = 1; k <= cnt; k++) { int c = po(i, k); for (int j = c; j < n; j += c) { dp[j]++; } } } int sz = -1; int ans; rep(i, 1, n) { if (dp[i] >= k) { dev.clear(); devisor(i); int p = dev.size(); if (p > sz) { ans = i; sz = dev.size(); } } } cout << ans << endl; return 0; }