#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch<'0' || ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') { x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); }
    return x * f;
}
const int N = 3007, mod = 998244353;
int n,K;
int f[N][N];
int DP(int i,int k) {
	if(k>i || k==0) return 0;	//先要判断是否越界，如果 k>i 可以会爆数组 f[N][N] 的下表，因为 N=3007 
	if(f[i][k] != -1) return f[i][k];
	if(i == k) return f[i][k] = 1;
	return f[i][k] = (DP(i-1,k-1) + DP(i,2*k)) % mod;
}
signed main()
{
	n = read(), K = read();
	memset(f, -1, sizeof(f));
	printf("%lld\n",DP(n,K));
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define reps(i, a, n) for (int i = (a); i < (n); ++i)
#define rep(i, n) reps(i, 0, n)
#define deps(i, a, n) for (int i = (a); i >= (n); --i)
#define dep(i, n) deps(i, n, 0)
#define inf 2147483647
#define mod 1000000007
#define int long long

int x, y;
map<int, int> mp;

int absll(int a)
{
	if (a > 0) return a;
	return -a;
}

int func(int a)
{
	if (mp.find(a) != mp.end()) return mp[a];
	if (a == 1) return mp[a] = absll(x - a);
	if (a % 2 == 0) return mp[a] = min(absll(x - a), func(a / 2) + 1);
	return mp[a] = min(absll(x - a), min(func((a + 1) / 2) + 2, func((a - 1) / 2) + 2));
}

signed main(void)
{
    cin >> x >> y;
	cout << func(y) << endl;
}
