// #include<bits/stdc++.h>
// using namespace std;
// #define ll long long int
// #define ft first
// #define sd second
// #define pb push_back
// #define pob pop_back
// #define str string
// #define map map<ll, ll>
// #define mmap multimap<ll, ll>
// #define FIO ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL)
// #define stk stack<ll>
// #define vt vector<char>
// #define set set<ll>
// #define mset multiset<ll>
// int main()
// {
// 	ll n,m;
// 	cin>>n>>m;
// 	ll gap=m-n+1;
// 	ll t1=n/(gap-1);
// 	for(ll i=m;i>=1;i--)
// 	{
// 		if((i*t1>=n &&i*(t1+1)<=m)||(i*(t1+1)>=n && i*(t1+2)<=m))
// 		{
// 			cout<<i;
// 			break;
// 		}
// 	}
// }
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int findMaxGCD(ll arr[], ll n)
{
    ll high = 0;
    for (ll i = 0; i < n; i++)
        high = max(high, arr[i]);
   ll count[high + 1] = {0};
    for (ll i = 0; i < n; i++)
        count[arr[i]]++;
 
   ll counter = 0;
 
    for (ll i = high; i >= 1; i--)
    {
        ll j = i;
       counter = 0;
   

        while (j <= high)
        {
          
 
            if(count[j] >=2)
               return j;
 
           else if (count[j] == 1)        
                counter++;        
 
            
            j += i;
 
            if (counter == 2)        
                return i;
        }
    }
}
 

int main()
{
    ll a,m;
    cin>>a>>m;
 	ll n = m-a+1;
 	ll arr[n];
 	ll k=a;
 	for(ll i=0;i<n;i++)
 	{
 		arr[i]=k;
 		k++;
 	}
    cout << findMaxGCD(arr, n);
 
    return 0;
}
#include <bits/stdc++.h>

using ll =long long;

using namespace std;

using Graph =vector<vector<ll> >;


int main(){
    int A,B;
    cin>>A>>B;
    vector<int>vb(B+1);
    for(int i=A;i<=B;i++){
        for(int j=1;j*j<=i;j++){
            if(i%j==0){
                vb[j]++;
                if(i/j!=j)vb[i/j]++;
            }
        }
    }
    int ans=0;
    
    for(int i=1;i<=B;i++){
        if(vb[i]>=2){
            ans=max(ans,i);
        }
    }
    
    cout<<ans<<endl;

}

