#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug true
#define debug2 false

std::vector<long long> divisor_enum(long long N){
    /*
    Copyright (c) 2021 0214sh7
    https://github.com/0214sh7/library/
    */
    std::vector<long long> R;
    if(N<=0)return R;
    long long s=0;
    for(long long i=1;i*i<=N;i++){
        if(N%i==0){
            R.push_back(i);
            if(i*i!=N)s++;
        }
    }
    for(long long i = s-1;i>=0;i--){
        R.push_back(N/R[i]);
    }
    return R;
}

int main(void){
    
    ll A,B;
    cin >> A >> B;
    
    vector<ll> C(214514,0);
    for(int i=A;i<=B;i++){
        vector<ll> Y = divisor_enum(i);
        REP(j,Y.size()){
            C[Y[j]]++;
        }
    }
    
    ll Ans = 1;
    REP(i,C.size()){
        if(C[i]>=2){
            Ans=max(Ans,i);
        }
    }
    cout << Ans << endl;
    
    return 0;
}

//c
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <queue>

#define	INF   1010101010LL
#define INFLL 1010101010101010101LL

using namespace std;

const int mod = 1000000007;
//const int mod = 998244353;

long long gcd(long long a, long long b)
{
	if (a < b) {
		long long t = a;
		a = b;
		b = t;
	}

	if (b == 0) {
		return a;
	}

	long long r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

int main()
{
	int a, b;
	cin >> a >> b;
	/*long long mx = 0;
	for (int i = a; i <= b; i++) {
		for (int j = i + 1; j <= b; j++) {
			mx = max(mx, gcd(i, j));
		}
	}
	cout << mx << endl;*/
	vector<vector<int>> t(b + 1);
	for (int i = 1; i <= b; i++) {
		for (int j = i; j <= b; j += i) {
			t[j].emplace_back(i);
		}
	}

	vector<int> ans;
	for (int i = a; i <= b; i++) {
		for (int j = 0; j < t[i].size(); j++) {
			ans.emplace_back(t[i][j]);
		}
	}
	sort(ans.rbegin(), ans.rend());

	for (int i = 0; i < ans.size() - 1; i++) {
		if (ans[i] == ans[i + 1]) {
			cout << ans[i] << endl;
			return 0;
		}
	}

	return 0;
}