#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 1000000001 int main(){ long long n,m; cin>>n>>m; long long T; if(n>=32)T = m+1; else{ T = 1; rep(i,n-1){ T *= 2; } } long long ans = 0LL; if(T <= m){ long long cur = 1LL; rep(i,n){ ans += cur; cur *= 2; } } else{ long long remain = n; long long cur = m; while(cur!=1){ ans += cur; cur = (cur+1)/ 2; remain--; } ans += remain; } cout<