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

int main(){
    long a, b, c, d, e;
    cin >> a >> b;
    c = b - a;
    
    for(int i = c; i > 0; i--){
        d = (a + (i - 1)) / i;
        e = b / i;
        
        if(e - d >= 1){
            cout << i << endl;
            break;
        }
    }
    
}
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<math.h>
using namespace std;
const int INF = 1e9+5;
#define ll long long int
#define vi vector<int>
#define vb vector<bool>
int main()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	int a,b;
	cin>>a>>b;
	int c = a+b;
	if(c>=15 && b>=8)
		cout<<1;
	else if(c>=10 && b>=3)
		cout<<2;
	else if(c>=3)
		cout<<3;
	else
		cout<<4;
}