n,k=map(int,input().split())
s=n-(1*k)+1
if k==1:
  print(0)
else:
  print(s-1) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k s=n-(1*k)+1 s n-(1*k)+1 n-(1*k) n 1*k 1 k 1 if k==1:
  print(0)
else:
  print(s-1) k==1 k 1 print(0) print 0 print(s-1) print s-1 s 1 n,k=map(int,input().split()) map(int,input().split()) n k=map(int,input().split()) map(int,input().split()) k s=n-(1*k)+1 n-(1*k)+1 s
n,k=map(int,input().split())
s=n-(1*k)+1
if k==1:
  print(0)
else:
  print(s-1)