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