import Data.List
import Data.Maybe

main :: IO ()
main = do
  [n,m] <- map read.words <$> getLine
  let divisors = [ i | i <- [1..(floor $ sqrt $ fromIntegral m)], m`mod`i == 0 ]
  if Nothing /= find (n<=) divisors then print $ (m`div`) $ fromJust $ find (n<=) divisors
    else print $ (m`div`) $ fromJust $ find (n<=) (reverse $ map (m`div`) divisors)