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