#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) // #define FOR(i, a) for(auto& i : a) #define all(a) a.begin(), a.end() #define int long long using namespace std; signed main(){ int n, k, ans = 0; cin >> n >> k; if(k != 1){ ans = 1; rep(i, 0, n - k) ans *= 2; }else{ rep(i, 3, n + 1){ int tmp = 1; rep(j, 0, i - 2) tmp *= 2; ans += tmp - 1; } } cout << ans << endl; }