import Data.List

solve :: Int -> Int -> [Int] -> Int
solve n k numbers = countBefore + countAfter
  where Just indexOf1 = elemIndex 1 numbers
        count v = if v `mod` (k - 1) == 0 then v `div` (k - 1) else (v `div` (k - 1)) + 1
        countBefore = count indexOf1
        countAfter  = count (n - indexOf1 - 1)

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine
  numbers <- map read . words <$> getLine
  print $ solve n k numbers