using System.Linq; using System.Collections.Generic; using System; public static class combi { public static IEnumerable> Comb(this IEnumerable items, int r) { if (r == 0) { yield return Enumerable.Empty(); } else { var i = 1; foreach (var x in items) { var xs = items.Skip(i); foreach (var c in Comb(xs, r - 1)) yield return c.Before(x); i++; } } } public static IEnumerable Before(this IEnumerable items, T first) { yield return first; foreach (var i in items) yield return i; } } public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var k = int.Parse(line[1]); getAns(n, k); } static void getAns(int n, int k) { var a = Enumerable.Range(1, n).ToList(); a.Remove(k); var count = 0; for (int i = 0; i < n - 1; i++) { var a0 = new List(); var w = a.Comb(i); foreach (var x in w) { a0.Clear(); a0.Add(k); var used = new bool[n + 1]; used[k] = true; foreach (var y in x) { a0.Add(y); used[y] = true; } var minb = 0; for (int j = 1; j <= n; j++) { if (!used[j]) { minb = j; break; } } a0.Sort(); if (a0[0] == k && a0[i] > minb) count++; } } Console.WriteLine(count); } }