#include<bits/stdc++.h>
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define Endl '\n'
#define codejam cout<<"Case #"<<t<<": ";
#define pl pair<ll,ll>
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////
const ll N=1e5;
void JAISHREERAM()
{
    ll n,i,j,ans=0;
    ll a,b;
    cin>>a>>b;
    ans=1;
    vector<int> f(200001,0);
    for(i=a;i<=b;i++)
    {
        for(j=1;j*j<=i;j++)
        {
            if(i%j==0)
            {
                f[i/j]++;
                if(f[i/j]>1) ans=max(ans,i/j);
                if(i/j!=j) 
                {
                    int x=i/j;
                    f[i/x]++;
                    if(f[i/x]>1) ans=max(ans,i/x);
                }
            }
        }
    }
    cout<<ans;
}
int main()
{
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        // codejam
        JAISHREERAM();
    }
    return 0;
}
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const int MOD = 1000000007;
#define PI = acos(-1)
using namespace std ;
int main(){
   fastio ;
   int a , b ;
   cin >> a >> b ;
   int num  =  b - a ;
   for(int i = num ; i >= 1 ; i--){
   	    int x = b/i;
   	    if((x-1)*i >= a){
   	    	  cout << i ; 
   	    	  break;
		   }
   }
}

