#include <iostream>
using namespace std;
int main() {
long int r = 1, n, k;
cin >> n >> k;
while (n > 0){
if (r > k){
r -= k;
}
r *= 2;
n --;
}
cout << r;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewoJbG9uZyBpbnQgciA9IDEsIG4sIGs7CgljaW4gPj4gbiA+PiBrOwoJd2hpbGUgKG4gPiAwKXsKCQlpZiAociA+IGspewoJCQlyIC09IGs7CgkJfQoJCXIgKj0gMjsKCQluIC0tOwoJfQoJY291dCA8PCByOwoJcmV0dXJuIDA7Cn0=