N, K = map(int, input().split()) if K != 1: print(2**(N - K)) else: print(2**(N - 1) - N)