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