// ProblemURL : https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	if k == 0 {
		fmt.Println(0)
	} else {
		fmt.Println(n - k)
	}
}
