
// International Master sm0016
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define raftaar ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll MOD1=1000000007;

const ll MOD2= 998244353;

const int N=1e6+6;


int main(){
	raftaar
	
	int a,b;cin>>a>>b;int ans=1;int check[N]={0};

	for(int i=a;i<=b;i++){

		for(int j=1;j*j<=i;j++){

			if(i%j==0){

				if(j*j==i) check[j]++;

				else{check[j]++;check[i/j]++;}
			}
		}
	}
	for(int i=1;i<=max(a,b);i++){

		if(check[i]>1) ans=max(ans,i);
	}

	cout<<ans;
}

#include <iostream>
using namespace std;

int main(){
    int a,b;cin>>a>>b;
    for(int c = b; ; c--) if((a + c - 1) / c < b / c){
        cout << c << endl;
        return 0;
    }
}