import Data.List


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

solve n k =
  if k==2 then n-1
  else div n (k-1)