#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned int; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) #define FOR(i,b,n) for(ll i=(b); i<(n); ++i) ll min_prime(ll n) { FOR(i, 2, sqrt(n)+1) if (n%i == 0) return i; return 1; } int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); ll n, m; cin >> n >> m; if ((ll)sqrt(m) * (ll)sqrt(m) >= n) { ll x = sqrt(m); for (ll i = m; i >= n; --i) if(i%x==0){ cout << i << endl; return 0; } } ll ma = 1; ll mai = 1; for (ll i = m; i >= n; --i) { ll x = min_prime(i); if (ma < x) { ma = x; mai = i; } } cout << mai << endl; return 0; }