#include #define rep(i,n) for(int i=0;i ; const ll INF = 1e18; const int MOD = 1000000007; map getPrimes_(ll x){ map res; for(ll i = 2; i * i <= x;i++){ if(x%i ==0){ res[i] = 0; while(x%i ==0) x /= i,res[i]++; } } if( x > 1) res[x] = 1; return res; } ll cnt_div(map p){ ll res = 1; for(auto k:p){ res *= k.second + 1; } return res; } int main(){ ll n; int k; cin >> n >> k; ll cnt_max = 0; ll ans = -1; map n_prime = getPrimes_(n); for(int i=1;i i_prime = getPrimes_(i); int res = 0; for(auto p:i_prime){ res += min(p.second,n_prime[p.first]); } if(res >= k){ ll cnt = cnt_div(i_prime); if(cnt_max < cnt ) ans = i,cnt_max = cnt; } } cout << ans << endl; return 0; }