import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val Array(n, k) = input.nextLine().split(" ").map(_.toInt)
      val ns          = input.nextLine().split(" ").map(_.toInt)

      val minIndex = ns.indexOf(1)

      val leftCount  = minIndex
      val rightCount = n - minIndex - 1

      val result = f(leftCount, k) + f(rightCount, k)

      output.println(result)
    }

    def f(c: Int, k: Int) = {
      c / (k - 1) + (if (c % (k - 1) == 0) 0 else 1)
    }
  }

}
