N,K = list(map(int,(input()).split()))
kubaru =[]
for n,k in enumerate(range(K)):
#  print(n,k)
  if n+1 != K:
    kubaru.append(1)
    N-=1
  else:
    kubaru.append(N)

print(max(kubaru)-min(kubaru))     N,K = list(map(int,(input()).split())) N list(map(int,(input()).split())) list map(int,(input()).split()) map int (input()).split() input()).split input() input split K kubaru =[] kubaru [] for n,k in enumerate(range(K)):
#  print(n,k)
  if n+1 != K:
    kubaru.append(1)
    N-=1
  else:
    kubaru.append(N) n k enumerate(range(K)) enumerate range(K) range K if n+1 != K:
    kubaru.append(1)
    N-=1
  else:
    kubaru.append(N) n+1 != K n+1 n 1 K kubaru.append(1) kubaru.append kubaru append 1 N-=1 N 1 kubaru.append(N) kubaru.append kubaru append N print(max(kubaru)-min(kubaru)) print max(kubaru)-min(kubaru) max(kubaru) max kubaru min(kubaru) min kubaru N,K = list(map(int,(input()).split())) list(map(int,(input()).split())) N K = list(map(int,(input()).split())) list(map(int,(input()).split())) K kubaru =[] [] kubaru N-=1 1 N
N,K = list(map(int,(input()).split()))
kubaru =[]
for n,k in enumerate(range(K)):
#  print(n,k)
  if n+1 != K:
    kubaru.append(1)
    N-=1
  else:
    kubaru.append(N)

print(max(kubaru)-min(kubaru))    
