#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define each(e, v) for(auto &e: v)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct io_setup{
    io_setup(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout << fixed << setprecision(15);
    }
} io_setup;

int main(){
    int A, B; cin >> A >> B; A--;

    rep3(i, B, 1){
        if((B/i)-(A/i) >= 2) {cout << i << '\n'; return 0;}
    }
}
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
const ll INF = 1LL << 60;
const double pi = acos(-1);
ll mod = 1000000007;

struct Edge {
    int to;
    long long w;
    Edge(int to, long long w) : to(to), w(w) {}
};

struct dsu {
    vector<int> d;
    dsu(int n = 0): d(n,-1) {}
    int findRoot(int x) {
        if(d[x] < 0) return x;
        return d[x] = findRoot(d[x]);
    }
    bool unite(int x,int y) {
        x = findRoot(x); y = findRoot(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return findRoot(x) == findRoot(y);}
    int size(int x) {return -d[findRoot(x)];}
};

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

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

template <typename T>
T my_lower_bound(vector<T> a, T lb, T ub, T k) {
    while(ub - lb > 1) {
        T mid = (lb + ub) / 2;
        if(a[mid] >= k) {
            ub = mid;
        }else{
            lb = mid;
        }
    }
    return ub;
}

int main() {
    ll a, b; cin >> a >> b;
    ll ans = 1;
    for(ll i = 2;i <= b / 2;++i) {
        ll j = 1;
        if(i * j < a) {
            if(a % i == 0) j = a / i;
            else j = a / i + 1;
        }
        ll val = i * j;

        if(a <= val && val <= b && a <= val + i && val + i <= b) {
            chmax(ans, i);
        }
    }
    cout << ans << endl;
    return 0;
}