inA = input().split(" ")
N = int(inA[0])
K = int(inA[1])
if(K == 1 or K == 0):
  print(0)
else:
  print((N-(K-1))-1) inA = input().split(" ") inA input().split(" ") ().split () input split " " N = int(inA[0]) N int(inA[0]) int inA[0] inA 0 K = int(inA[1]) K int(inA[1]) int inA[1] inA 1 if(K == 1 or K == 0):
  print(0)
else:
  print((N-(K-1))-1) K == 1 or K == 0 K == 1 K 1 K == 0 K 0 print(0) print 0 print((N-(K-1))-1) print (N-(K-1))-1 N-(K-1) N K-1 K 1 1 N = int(inA[0]) int(inA[0]) N K = int(inA[1]) int(inA[1]) K inA = input().split(" ") input().split(" ") inA
inA = input().split(" ")
N = int(inA[0])
K = int(inA[1])
if(K == 1 or K == 0):
  print(0)
else:
  print((N-(K-1))-1)