import math n,l = map(int,input().split()) print(2 ** max(1,math.ceil(n/l)) - 1)