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