x, y = [int(a) for a in input().split()] c = x // 2 // y if x / 2 % y : print(c * y) else : print((c - 1) * y)