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