import math L, K = map(int, input().split()) print(K * math.ceil(L / (2 * K) - 1))