output_description: Print the minimum number of operations required.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      A_1 A_2 ... A_N
attempt: # coding : utf-8
  import math
  
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  
  # 全部を最小値1にする必要がある
  minNum = 1
  minIndex = A.index(minNum)
  
  # 最小値1の左側の個数
  leftNum = minIndex
  # print(leftNum)
  
  # 最小値1の右側の個数
  rightNum = N - leftNum - 1
  # print(rightNum)
  
  # 左側の変換について、最初のステップを右側の数を含めても同じ回数になる場合
  leftMod = leftNum % (K - 1)
  if leftMod != 0:
      rightNum -= leftMod
      if rightNum < 0:
          rightNum = 0
  
  # 右側の変換について、最初のステップを左側の数を含めても同じ回数になる場合
  rightMod = rightNum % (K - 1)
  if rightMod != 0:
      leftNum -= rightMod
      if leftNum < 0:
          leftNum = 0
  
  leftCount = math.ceil(leftNum / (K - 1))
  
  rightCount = math.ceil(rightNum / (K - 1))
  
  ans = leftCount + rightCount
  
  print(ans)
  
problem_description: Statement
  
  There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence
  is a permutation of 1, 2, ..., N.
  
  On this sequence, Snuke can perform the following operation:
  
    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.
  
  Snuke would like to make all the elements in this sequence equal by repeating
  the operation above some number of times. Find the minimum number of
  operations required. It can be proved that, Under the constraints of this
  problem, this objective is always achievable.
samples: [{"input": "4 3\n    2 3 1 4", "output": "2\n    \n\nOne optimal strategy is as follows:\n\n  * In the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\n  * In the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\n* * *"}, {"input": "3 3\n    1 2 3", "output": "1\n    \n\n* * *"}, {"input": "8 3\n    7 3 1 8 4 6 2 5", "output": "4"}]