{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

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

solve :: Int -> Int -> Int
solve n k = (n + k - 3) `div` (k - 1)

readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt
