fun main(){ val (l, k) = readLine()!!.split(" ").map(String::toInt) var i = 0 while(l > 2 * i * k){ i ++ } println((i - 1) * k) }