import Data.List
main :: IO()
main = do
  [n, k]<- map read . words <$> getLine
  vals <- map read . words <$> getLine
  print $ slv n k vals

slv :: Int -> Int -> [Int] -> Int
slv n k vals = d3 + m3val
  where (d3, m3) = (n - 1) `divMod` (k - 1)
        m3val | m3 /= 0 = 1
              | otherwise = 0