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