a, b = map(int, input().split()) c = a // (b * 2) if c * b * 2 == a: c -= 1 print(c * b)