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

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

rest = N - K
if rest <= 0 or K == 1:
  print(0)
else:
  print(rest)