def solve(N,K): if K==1: return pow(2,N-K)-N else: return pow(2,N-K) N,K=map(int,input().split()) print(solve(N,K))