#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); map factorize(long long n) { map ret; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { ++ret[i]; n /= i; } } if (n != 1) ret[n] = 1; return ret; } int divs[100000+1]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); for (int i = 1; i <= 100000; i++) { for (int j = i; j <= 100000; j += i) divs[j]++; } int n, k; cin >> n >> k; auto fac = factorize(n); int ret = 0; for (int i = 1; i < n; i++) { int x = i; int cnt = 0; for (auto &pr: fac) { REP (j, pr.second) { if (x % pr.first == 0) { ++cnt; x /= pr.first; } } } if (cnt < k) continue; if (ret == 0 || divs[i] > divs[ret]) ret = i; } cout << ret << endl; return 0; }