#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) begin(v),end(v) template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } using ll = long long; using pii = pair; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 1000000007; constexpr bool debug = 0; //---------------------------------// int main() { int N, K; cin >> N >> K; vector sieve(N, true); vector pfcnt(N, 0), divc(N, 1), cnt(N, 0); FOR(i, 2, N) { if (!sieve[i]) continue; int ncnt = 0; for (int m = N; m % i == 0; m /= i, ++ncnt); for (int j = 1, t = i * j; t < N; ++j, t += i) { if (j % i > 0) cnt[j] = 0; cnt[t] = cnt[j] + 1; pfcnt[t] += min(cnt[t], ncnt); divc[t] *= cnt[t] + 1; sieve[t] = false; } } int ansc = -1, ans = -1; FOR(i, 1, N) if (pfcnt[i] >= K && chmax(ansc, divc[i])) ans = i; cout << ans << endl; return 0; }