n,m=gets.split.map{|e| e.to_i} if n==2 && m==1 then puts 0 elsif m!=1 then puts 2**(n-m) else ans=0 2.upto(n-1){|i| ans=ans+2**(n-i)-1 } puts ans end