n, k = (int(i) for i in input().split())

if k==1:
  dif=0
  
if k>1:
  dif=n-k
  
print(dif) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i n, k = (int(i) for i in input().split()) n (int(i) for i in input().split()) k if k==1:
  dif=0
   k==1 k 1 dif=0 dif 0 if k>1:
  dif=n-k
   k>1 k 1 dif=n-k dif n-k n k print(dif) print dif dif=n-k n-k dif n, k = (int(i) for i in input().split()) (int(i) for i in input().split()) n k = (int(i) for i in input().split()) (int(i) for i in input().split()) k dif=0 0 dif
n, k = (int(i) for i in input().split())

if k==1:
  dif=0
  
if k>1:
  dif=n-k
  
print(dif)