l, p = gets.chomp.split(" ").map &:to_i count = (l.to_f/(p*2)).ceil-1 puts "#{p*count}"