#include <iostream>
using namespace std;
int f2(int r, int n, int k){
if (n == 0) return r;
if (r <= k) return f2(r * 2, n - 1, k);
else return f2(2 * (r-k), n - 1, k);
}
int main() {
int n, k, r = 1;
cin >> n >> k;
cout << f2(r, n, k);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGYyKGludCByLCBpbnQgbiwgaW50IGspewoJaWYgKG4gPT0gMCkgcmV0dXJuIHI7CglpZiAociA8PSBrKQlyZXR1cm4gZjIociAqIDIsIG4gLSAxLCBrKTsKCWVsc2UgcmV0dXJuIGYyKDIgKiAoci1rKSwgbiAtIDEsIGspOwoJCn0JCgppbnQgbWFpbigpIHsKCWludCBuLCBrLCByID0gMTsKCWNpbiA+PiBuID4+IGs7Cgljb3V0IDw8IGYyKHIsIG4sIGspOwoJcmV0dXJuIDA7Cn0=