# bit DPせず計算で解ける問題なのに気付けず。 N,K=map(int,input().split()) if K!=1: print(pow(2,N-K)) else: print(pow(2,N-1)-N)