N,K = map (int, input ().split ())
if K == 1:
  print (0)
else:
  x = N-K
  print (x) N,K = map (int, input ().split ()) N map (int, input ().split ()) map int input ().split () ().split () input split K if K == 1:
  print (0)
else:
  x = N-K
  print (x) K == 1 K 1 print (0) print 0 x = N-K x N-K N K print (x) print x K = map (int, input ().split ()) map (int, input ().split ()) K N,K = map (int, input ().split ()) map (int, input ().split ()) N x = N-K N-K x
N,K = map (int, input ().split ())
if K == 1:
  print (0)
else:
  x = N-K
  print (x)