import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, k) = in.readLine.split(" ").map(_.toInt)
  val seq = in.readLine.split(" ").map(_.toInt)
  val idx = seq.indexWhere(_ == 1)
  val pos = idx + 1
  val d = k-1
  val l = idx % (d)
  val ans = (idx + (d-1)) / d + (n - (pos+l) + (d-1)) / d
  println(ans)
}