#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	long long n, m;
	cin >> n >> m;

	if (2*m <= n) {
		cout << 0 << endl;
	}
	else if (2*n <= m) {
		cout << 1 << endl;
	}
	else if (m <= n) {
		cout << 2 << endl;
	}
	else if (2 * n <= m + m - ((n + n - m / 2) - m)) {
		cout << 3 << endl;
	}
	else {
		cout << 4 << endl;
	}


	return 0;
}
