n,l=map(int,input().split()) num=-(n//-l) print(2**num-1)