from sys import stdin
import string

n,k = [int(x) for x in stdin.readline().rstrip().split()]

if k == 1:
    print(0)
    exit()
print(n-k) from sys import stdin import string string int(x) for x in stdin.readline().rstrip().split() for x in stdin.readline().rstrip().split() x stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split for x in stdin.readline().rstrip().split() int(x) int x n,k = [int(x) for x in stdin.readline().rstrip().split()] n [int(x) for x in stdin.readline().rstrip().split()] k if k == 1:
    print(0)
    exit() k == 1 k 1 print(0) print 0 exit() exit print(n-k) print n-k n k n,k = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] n k = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] k
from sys import stdin
import string

n,k = [int(x) for x in stdin.readline().rstrip().split()]

if k == 1:
    print(0)
    exit()
print(n-k)