main = do [w, d] <- map read . lines <$> getContents print $ foldr (\x acc -> x-(acc `div` x^2)) w [2..d]