#include <bits/stdc++.h>
using namespace std;

int main() {
    const int N = 210000;
    int a, b;
    cin >> a >> b;
    int res = 0;
    for (int i = 1; i <= N; i++) {
        if (a % i == 0) {
            if (b / i - a / i >= 1) res = max(res, i);
        } else {
            if (b / i - a / i >= 2) res = max(res, i);
        }
    }
    cout << res << endl;
}
#include<bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define pii pair<int,int>
#define pb   push_back
typedef int64_t ll;
const ll M = 1e9 + 7;
const ll INF =  1e6+10;
bool prime[INF]={1};
 
//vector<vector<ll>> numways(target+1, vector<ll> (n+1, 0));
ll d[INF]={};
 int dx[]={0,0,1,-1};
 int dy[]={1,-1,0,0};
 string ds="RLDU";

long long int invmod(long long int i){
    if(i==1) return 1;
    return (MOD - ((MOD/i)*invmod(MOD%i))%MOD+MOD)%MOD;
}
ll binpow(ll a,ll b)
{
    if(b==0) return 1;
    if(b==1) return a%MOD;
    ll temp=binpow(a,b/2);
    if(b%2==0) return (temp*temp)%MOD;
    else return (((temp*temp)%MOD)*a)%MOD;
}
ll tot(ll n) {
   ll result = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}
 
void phi_1_to_n(int n) {//nloglogn
    vector<int> phi(n + 1);
    phi[0] = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
        phi[i] = i;

    for (int i = 2; i <= n; i++) {
        if (phi[i] == i) {
            for (int j = i; j <= n; j += i)
                phi[j] -= phi[j] / i;
        }
    }
}
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}
bool is_prime(ll n) {

    if (n == 1) 
        return false;
   ll i = 2;
    while (i*i <= n) {
        if (n % i == 0)
         {return false; }
        i += 1;  }
 return true;}
void SieveOfEratosthenes() 
{ 	prime[1]=0;prime[0]=0;
	for (int p=2; p*p<=INF; p++) 
	{ 	if (prime[p] == true) 
		{for (int i=p*p; i<=INF; i += p) 
				prime[i]=false; 
		} } }
int countteampairs(int a[],int s,int n,map<int,int>m)
{ int k=0; 
    for(int i=0;i<n;i++)
    { for(int j=i+1;j<n;j++)
         {    if(a[i]+a[j]<=s)
             { if(m[a[i]]>0 && m[a[j]]>0)
                 {  if(a[i]==a[j] && m[a[i]]<2)
                 {
                     break;
                 }  k++; m[a[i]]--; m[a[j]]--;
                 }
 }
 }
 }   return k;
}
void div() 
{ 
   for(ll i=1;i<INF;i++)
    {
       for(ll j=i;j<INF;j+=i)
        {
            d[j]+=i;
         d[j]=d[j]%M;
        }
    }

}

int LCSubStr(string X, string Y, int m, int n)
{
   
    int LCSuff[m + 1][n + 1];
    int result = 0; 
    for (int i = 0; i <= m; i++)
    {
        for (int j = 0; j <= n; j++)
        {
          
            if (i == 0 || j == 0)
                LCSuff[i][j] = 0;
 
            else if (X[i - 1] == Y[j - 1]) {
                LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1;
                result = max(result, LCSuff[i][j]);
            }
            else
                LCSuff[i][j] = 0;
        }
    }
    return result;
}  //min_element(v.begin(),v.begin()+mi) >= max_element(v.begin()+mi+1,v.end())
vector<vector<ll>> dp(505, vector<ll> (505, 0));
 vector<ll>adj[INF];int ans=0;
vector<ll>fact(INF);
void solve() {
int a,b;
cin>>a>>b;
for(int c=b;;c--)
{
    if(b/c-(a-1)/c>=2)
    {
        cout<<c<<endl; return;
    }
}
}
int main() {

 
// fact[1]=1;
// fact[0]=0;
// for(ll i=2;i<INF;i++)
// {
//     fact[i]=((fact[i-1]%M)*(i%M))%M;
// }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
{
solve();
}
return 0;
}

