n, k = map(int,input().split()) if k == 1: if n == 2: ans = 0 elif n == 3: ans = 1 elif n == 4: ans = 4 else: ans = 0 for i in range(n - 1): #print(i) if i == n - 2: ans += 2 ** (i - 1) else: ans += 2 ** i else: ans = 2 ** (n - k) print(ans)