N,K = map(int,input().split())

if K == 1:
	print(0)
	exit()

minNum = 1
maxNum = N - (K-1)

print(maxNum - minNum) N,K = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K if K == 1:
	print(0)
	exit() K == 1 K 1 print(0) print 0 exit() exit minNum = 1 minNum 1 maxNum = N - (K-1) maxNum N - (K-1) N K-1 K 1 print(maxNum - minNum) print maxNum - minNum maxNum minNum minNum = 1 1 minNum N,K = map(int,input().split()) map(int,input().split()) N K = map(int,input().split()) map(int,input().split()) K maxNum = N - (K-1) N - (K-1) maxNum
N,K = map(int,input().split())

if K == 1:
	print(0)
	exit()

minNum = 1
maxNum = N - (K-1)

print(maxNum - minNum)