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

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

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