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