using System; using System.Collections.Generic; using System.Linq; class Program { static string ReadLine() { return Console.ReadLine(); } static int ReadInt() { return int.Parse(ReadLine()); } static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); } static string[] ReadStrings() { return ReadLine().Split(); } /* static long Combination(int n, int r) { long num = 1; long den = 1; for (int i = 0; i < r; i++) { num *= n - i; den *= r - i; } return num / den; } static long Calc(int n, int k) { if (k == 1 && n == 2) return 0; long sum = 0; int p = n - k; for (int i = 0; i <= p; i++) { sum += Combination(p, i); } return sum; } */ static int Calc(int n, int k) { int ans = 0; var xs = new bool[n]; for (int i = 1; i < (1 << n); i++) { int max = 0; int min = int.MaxValue; bool ng = false; for (int j = 0; j < n; j++) { if ((i & (1 << j)) != 0) { if (j < k) { // 先頭は k なのでスキップ ng = true; break; } xs[j] = true; max = j; } else { xs[j] = false; min = Math.Min(min, j); } } if (ng) continue; if (xs[k] && max > min) { ans++; } } return ans; } static void Main() { var xs = ReadInts(); int n = xs[0], k = xs[1]; Console.WriteLine(Calc(n, k-1)); } }