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