n,k=map(int,input().split())

a=0

if k != 1:
  a=n-k
 
print(a) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k a=0 a 0 if k != 1:
  a=n-k
  k != 1 k 1 a=n-k a n-k n k print(a) print a k=map(int,input().split()) map(int,input().split()) k a=0 0 a n,k=map(int,input().split()) map(int,input().split()) n a=n-k n-k a
n,k=map(int,input().split())

a=0

if k != 1:
  a=n-k
 
print(a)