n, k = [int(x) for x in input().split()]

if k is 1:
	max_diff = 0
else:
	max_diff = n - k
    
print(max_diff) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x n, k = [int(x) for x in input().split()] n [int(x) for x in input().split()] k if k is 1:
	max_diff = 0
else:
	max_diff = n - k
     k is 1 k 1 max_diff = 0 max_diff 0 max_diff = n - k max_diff n - k n k print(max_diff) print max_diff n, k = [int(x) for x in input().split()] [int(x) for x in input().split()] n max_diff = 0 0 max_diff k = [int(x) for x in input().split()] [int(x) for x in input().split()] k max_diff = n - k n - k max_diff
n, k = [int(x) for x in input().split()]

if k is 1:
	max_diff = 0
else:
	max_diff = n - k
    
print(max_diff)
