import math N, L = map(int, input().split()) N = math.ceil(N / L) print(int(math.pow(2,N) - 1))