N,K = map(int,input().split()) if K == 1: ans = 0 ii = 0 for i in range(N-2,0,-1): ans += i*2**ii ii += 1 print(ans) exit() ans = 2**(N-K) print(ans)