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

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int a, b, c;
    cin >> a >> b;
    c = a + b;

    if (c >= 15 && b >= 8) cout << 1 << endl;
    else if (c >= 10 && b >= 3) cout << 2 << endl;
    else if (c >= 3) cout << 3 << endl;
    else cout << 4 << endl;
}
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b;
    cin >> a >> b;
    for (int i = b - a; i > 0; i--) {
        int t1 = (a - 1) / i + 1;
        int t2 = b / i;
        if (t1 < t2) {
            cout << i << endl;
            break;
        }
    }
        return 0;
}