a, b = io.read("*n", "*n") c = math.floor(a / (2 * b)) if(c * 2 * b == a) then c = c - 1 end print(c * b)