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

A=N-K

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

A=N-K

if K>1:
  print(A)
else:
  print(0)