#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996) #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define len(x) ((int)(x).size()) #define tmax(a,b,c) max((a),max((b),(c))) #define tmin(a,b,c) min((a),min((b),(c))) #define debug(x) cerr << #x << " is " << x << endl; typedef pair Pii; typedef vector Vi; typedef vector > VVi; typedef long long ll; const int inf = 2e9; const ll ll_inf = 1e17; const int mod = 1e9 + 7; const long double eps = 1e-10; int main() { int N, K; cin >> N >> K; if (N==2 && K==1) { cout << 0 << endl; return 0; } ll ans = 1; if (K == 1) { rep(i,0,N-1) ans <<= 1; ans -= N; } else { rep(i,0,N-K) ans <<= 1; } cout << ans << endl; return 0; }