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