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

if N > K and K !=1:
	wide = N - K
elif N == K or K==1:
  	wide = 0
else:
    wide = 0
    
print(wide) N,K=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K if N > K and K !=1:
	wide = N - K
elif N == K or K==1:
  	wide = 0
else:
    wide = 0
     N > K and K !=1 N > K N K K !=1 K 1 wide = N - K wide N - K N K elif N == K or K==1:
  	wide = 0 N == K or K==1 N == K N K K==1 K 1 wide = 0 wide 0 wide = 0 wide 0 print(wide) print wide wide = 0 0 wide N,K=map(int,input().split()) map(int,input().split()) N wide = 0 0 wide wide = N - K N - K wide K=map(int,input().split()) map(int,input().split()) K
N,K=map(int,input().split())

if N > K and K !=1:
	wide = N - K
elif N == K or K==1:
  	wide = 0
else:
    wide = 0
    
print(wide)