fun main(array: Array<String>) {
	val inputs = readLine()!!.split(" ")
	val n = Integer.parseInt(inputs[0])
	val k = Integer.parseInt(inputs[1])

	if(k == 1) {
		println(0)
		return
	}
	println(n - k)
}
