#include using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--) #define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--) #define all(x) (x).begin(), (x).end() #define sz(x) ((ll)(x).size()) #define len(x) ((ll)(x).length()) ll n, k; vector used; ll ans = 0; void dfs(ll bit, ll k, ll cnt = 0) { if ((bit == ((1LL << n) - 1)) && (cnt == 1)) { ans++; return; } rep(i, n) { if (used[i]) continue; ll v = (k > (i + 1)) ? 1 : 0; if ((v == 0) || ((v == 1) && (cnt == 0))) { used[i] = true; dfs(bit | (1LL << i), i + 1, cnt + v); used[i] = false; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); cin >> n >> k; used.resize(n, false); used[k - 1] = true; dfs(1LL << (k - 1), k); cout << ans << endl; return 0; }