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