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