package net.ipipip0129.kotlin.yukicoder import java.io.BufferedReader import java.io.BufferedWriter import java.io.InputStreamReader import java.io.OutputStreamWriter fun main(args: Array) { val br = BufferedReader(InputStreamReader(System.`in`)) val bw = BufferedWriter(OutputStreamWriter(System.out)) val data = br.readLine().split(" ").map { it.toInt() }.toTypedArray() val len = data[0] val oCount = data[1] var count = len / oCount if (len % oCount == 0) count -= 1 count /= 2 count *= oCount bw.write("$count") bw.flush() br.close() bw.close() }