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

typedef long long ll;
ll MOD = 1000000007;

const ll INF = 1001001001001001;
const int inf = 1001001001;
using P = pair<ll, ll>;

int main() {
    ll A, B;
    cin >> A >> B;
    ll C = B-A;
    for (ll i = C; i >= 1; i--) {
        ll D = B/i;
        if (i*(D-1)>= A) {
            cout << i << endl;
            return 0;
        }
    }
    
}
    
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)


void MAIN() {
    LL A, B;
    scanf("%lld%lld", &A, &B);

    LL ans = 1;
    for (LL i=1; i<=B; i++) {
	LL d = B/i - (A-1)/i;
	if (d >= 2) ans = i;
    }
    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}

