#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define ll long long int
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define Mod 1000000007
#define limit 1000008
using namespace std;
ll x;
map<ll,ll>mymap;

ll rec(ll y)
{
    if(mymap[y])  return mymap[y];
    if(y<=x) return mymap[y] = x-y;

    if(y&1)
    {
        return mymap[y] = min(abs(y-x),2+min(rec((y+1)/2),rec((y-1)/2)));
    }
    else return mymap[y] = min(1+rec(y/2),y-x);
}

void solve(ll tc)
{
    ll i,y,m;
    cin >> x >> y;

    cout <<rec(y)<<endl;
    return ;
}
int  main()
{
//    Fast
//    Freed
//    Fout
    ll tc,tt=1;
   // cin >> tt;
    for(tc=1; tc<=tt; tc++)
        solve(tc);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=5005,mod=998244353;
int n,m,l=1,dp[N][N],c[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=i;j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
	while((1<<l)<m)
		l++;
	dp[l+1][0]=1;
	for(int i=l+1;i;i--)
	{
		for(int j=0;j<=m;j++)
		{
			for(int k=0;k<=n;k+=2)
			{
				int v=(j+(1<<(i-1))*k);
				if(v>m)
					break;
				dp[i-1][v]=(dp[i-1][v]+1ll*dp[i][j]*c[n][k]%mod)%mod;
			}
		}
	}
	printf("%d\n",dp[0][m]);
	return 0;
}