#include #include #include #include #include #include using namespace std; void check(int n, int k) { vector a(n); for (int i = 0; i < n; i++) { a[i] = i + 1; } do { if (a[0] != k) { continue; } int n_big = 0; for (int i = 1; i < n; i++) { if (a[i - 1] > a[i]) { n_big++; } } if (n_big == 1) { for (auto e : a) { cout << e << " "; } cout << endl; } } while (next_permutation(a.begin(), a.end())); } int main() { int n, k; // check(5,1); // return 0; cin >> n >> k; long long ans = 0; if (k == 1) { // 1 ??? 5 ??? -> 2^3 - 1 // 1 ?? 4 ?? 5 -> 2^2 - 1 for (int i = n - 2; i >= 0; i--) { ans += (1LL << i) - 1; } } else { ans = 1LL << (n - k); } cout << ans << endl; return 0; }