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