L, K = map(int, input().split()) t = (L // (2 * K)) if L % (2 * K) == 0: t -= 1 print(K * t)