x, y = map(int, input().split()) c = x // 2 // y if x / 2 % y : print(c * y) else : print((c - 1) * y)