#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	if(N == 2 && K == 1) {
		cout << 0 << endl;
		return 0;
	}

	if(K == 1) {
		int a = 0;
		for(int i = 3; i <= N; i++) {
			a = a * 2 + i - 2;
		}
		cout << a << endl;
	}
	else {
		cout << (1 << (N - K)) << endl;
	}
}