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: n, k = map(int, input().split())
  a = input().split()
  
  a = [int(m) for m in a]
  t = a.index(min(a))
  
  leftar = []
  rightar = []
  leftco = 0
  rightco = 0
  startco = 1
  # 左側
  for i in range(1, k + 1):
      if (t - k + i) / (k - 1) <= 0:  # マイナス、０のときは０とする
          leftar.append(leftco)
      elif (t - k + i) % (k - 1) == 0:
          p = int((t - k + i) / (k - 1))
          for j in range(1, p + 1):
              leftco += 1
          leftar.append(leftco)
          leftco = 0
      else:  # 割り切れないときは繰り上げ
          p = int((t - k + i) / (k - 1)) + 1
          for j in range(1, p + 1):
              leftco += 1
          leftar.append(leftco)
          leftco = 0
  # 右側
  for i in range(1, k + 1):
      if (n - t - i) / (k - 1) <= 0:
          rightar.append(rightco)
      if (n - t - i) % (k - 1) == 0:
          q = int((n - t - i) / (k - 1))
          for j in range(1, q + 1):
              rightco += 1
          rightar.append(rightco)
          rightco = 0
      else:
          q = int((n - t - i) / (k - 1)) + 1
          for j in range(1, q + 1):
              rightco += 1
          rightar.append(rightco)
          rightco = 0
  
  sumar = [x + y + startco for (x, y) in zip(leftar, rightar)]
  
  print(min(sumar))
  
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"}]