using System; using System.Linq; class Program { static void Main() { var a = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); if(a[1]==1) { var k = a[0] - 2; if(k==0) Console.WriteLine(0); else { int p = (int)Math.Pow(2,k); int t = a[0]-3; int count =0; for(;t>0;t--)count+=t; Console.WriteLine(count+p); } } else Console.WriteLine(Math.Pow(2,a[0]-a[1])); } }