#line 1 "c.cpp"
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define FOR(i, a, b) for(int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

void Case(int i) { cout << "Case #" << i << ": "; }
#pragma endregion Macros

#line 1 "/home/siro53/kyo-pro/compro_library/math/ceil_floor_div.hpp"
template<class T>
T ceil_div(T a, T b) {
    if(b < 0) a = -a, b = -b;
    return (a >= 0 ? (a + b - 1) / b : a / b);
}

template<class T>
T floor_div(T a, T b) {
    if(b < 0) a = -a, b = -b;
    return (a >= 0 ? a / b : (a - b + 1) / b);
}
#line 70 "c.cpp"

int main() {
    int A, B;
    cin >> A >> B;
    int ans = 1;
    FOR(g, 1, 200000 + 1) {
        int l = (A-1)/g;
        int r = B/g;
        if(r - l >= 2) chmax(ans, g);
    }
    cout<<ans<<endl;
}

// Problem: C - Max GCD 2
// Contest: AtCoder - Japanese Student Championship 2021
// URL: https://atcoder.jp/contests/jsc2021/tasks/jsc2021_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

// Problem: C. The Sports Festival
// Contest: Codeforces - Codeforces Round #715 (Div. 2)
// URL: https://codeforces.com/contest/1509/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)


/*
    authored by
    aden_frost
    on 07-03-2021
    Go Corona Corona Go!!
    hurray! mission - 1 - completed;
    mission - 2
    ____________

    40 more to go
*/
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define lli long long int
#define MOD1 998244353
#define MOD 1000000007
using namespace std;
using namespace std::chrono;
void fastaf(void)
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}
void solve(void)
{
	lli A,B;
	cin>>A>>B;
	map<lli,lli> mp;
	lli maxx=INT_MIN;
	for(lli i=A;i<=B;i++)
	{
		for(lli j=1;j<=sqrt(i);j++)
		{
			if(i%j==0)
			{
				if(i/j==j)
				{
					if(mp.find(j)!=mp.end())
						maxx=max(maxx,j);
					mp[j]++;
				}
				else
				{
					if(mp.find(j)!=mp.end())
						maxx=max(maxx,j);
					if(mp.find(i/j)!=mp.end())
						maxx=max(maxx,i/j);
					mp[j]++;
					mp[i/j]++;
				}
			}
		}
	}
	cout<<maxx;
}
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
int main()
{
    fastaf(); 
    // int Testcases;
    // cin>>Testcases;
    // //freopen("input.txt","r",stdin);
    // //freopen("output.txt","w",stdout);
    // while(Testcases--)
    // {
        solve();
        cout<<"\n";
    // }
    return 0;
}