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