import math l, k = map(int, input().split()) print(math.ceil(l / (k * 2) - 1) * k)