l, k = map(int, input().split()) ans = ((l + 2 * k - 1) // (2 * k) - 1) * k print(ans)