l, k = gets.split.map(&:to_i) count = 0 if l.even? count = l / 2 / k count -= 1 if l % k == 0 else count = (l - 1) / 2 / k end p count * k