N, K = [int(_) for _ in raw_input().split(" ")]
if K == 1:
  print 0
else:
  print (N - K) int(_) for _ in raw_input().split(" ") for _ in raw_input().split(" ") _ raw_input().split(" ") ().split () raw_input split " " for _ in raw_input().split(" ") int(_) int _ N, K = [int(_) for _ in raw_input().split(" ")] N [int(_) for _ in raw_input().split(" ")] K if K == 1:
  print 0
else:
  print (N - K) K == 1 K 1 print print (N - K) print N - K N K K = [int(_) for _ in raw_input().split(" ")] [int(_) for _ in raw_input().split(" ")] K N, K = [int(_) for _ in raw_input().split(" ")] [int(_) for _ in raw_input().split(" ")] N
N, K = [int(_) for _ in raw_input().split(" ")]
if K == 1:
  print 0
else:
  print (N - K)