L, K = map(int, input().split()) for i in range(1, L // K): if K * i * 2 >= L: print((i - 1) * K) break