import Control.Arrow
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = breads >>= main'
    where
        main' [n, k] = getLine >> print (solve n k)

-- |
-- >>> solve 4 3 
-- 2
-- >>> solve 3 3
-- 1
-- >>> solve 8 3 
-- 4
solve :: Int -> Int -> Int 
solve n k
    | m == 0 = r
    | otherwise = r + 1
    where
        (r, m) = (n - 1) `divMod` (k - 1)

breads :: IO [Int]
breads = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine