#include <bits/stdc++.h>
#ifdef LILY
#include "Debug.h"
#else
#define var(...) (0)
#define dbg(...) (0)
#endif
using int32 = int;
using int64 = long long;
using namespace std;

class Solution
{
#define int int32
#define sfor(i, n) for (int i = 1; i <= (n); ++i)
#define tfor(i, n) for (int i = 0; i < (n); ++i)
#define INF 0x3f3f3f3f
#define EPS 1e-5

    double a, b;
    int res = 1;

    void reals()
    {
        int dist = b - a;
        for (res = dist; res > 1; res--)
        {
            double left = a / res, right = b / res;
            if ([&]() {
                int cnt = 0;
                for (int j = ceil(left); j <= right; j++)
                    if (++cnt == 2) return true;
                return false;
            }())
            {
                return;
            }
        }
    }

public:
    Solution()
    {
        cin >> a >> b;
        reals();
        cout << res << endl;
    }
#undef int
#undef tfor
#undef sfor
};

int32 main()
{
#ifdef LILY
    while (1)
#endif
        Solution();
    return 0;
}

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

int gcd(int a, int b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}

int main(void) {
	int A, B, ans = 1;

	cin >> A >> B;
	for (int i = 1; i <= B; i++) {
		if (floor(B / i) - floor((A - 1) / i) >= 2) {
			ans = i;
		}
	}

	cout << ans << endl;

	return 0;
}