//
// Created by yamunaku on 2021/04/17.
//

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    int a, b;
    cin >> a >> b;
    int ans = 1;
    repl(i, 1, b + 1) {
        if (b / i - (a - 1) / i >= 2) ans = i;
    }
    cout << ans << endl;
    return 0;
}

#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;
}