#include using namespace std; typedef long long ll; typedef pair lpair; const ll MOD = 1e9 + 7; const ll INF = 1e18; #define rep(i,m,n) for(ll i = (m); i < (n); i++) #define rrep(i,m,n) for(ll i = (m); i >= (n); i--) #define print(x) cout << (x) << endl; #define print2(x,y) cout << (x) << " " << (y) << endl; #define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout< factor(ll M){ //素因数分解 vector dd; if(M == 1){ dd.push_back(1); return dd; } for(ll i = 2; i*i <= M; i++){ while(M % i == 0){ dd.push_back(i); M /= i; } } if(M != 1) dd.push_back(M); sort(dd.begin(), dd.end()); return dd; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N,K; cin >> N >> K; vector dd = factor(N); ll nn = dd.size(); // printa(dd, nn); // vector tmp = factor(75600); // printa(tmp, tmp.size()); ll m = 1; map mp; rep(i,0,nn) mp[dd[i]]++; ll cnt = 0; while(cnt < K){ for(auto &e: mp){ if(e.second > 0){ m *= e.first; mp[e.first]--; cnt++; if(cnt >= K) break; } } } ll max_val = 0, max_pos = 0; for(int t = m; t < N; t += m){ vector k = factor(t); map mp2; rep(i,0,k.size()) mp2[k[i]]++; ll v = 1; for(auto &e: mp2) v *= (e.second) + 1; if(max_val < v){ max_val = v; max_pos = t; } } print(max_pos); // for(auto &e: mp){ // print(e.first); // } }