import Data.Foldable main::IO() main = do w <-fmap read getLine d <-fmap read getLine let f1 (w,r) d = (w-amt,amt) where amt = truncate $ fromIntegral w / fromIntegral(d*d) print . snd . foldl' f1 (w,0) $[d,(d-1)..1]