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