main = getLine >>= print . solve . map read . words

solve (n:m:_) = if m `mod` n == 0
                then m `div` n
                else head $ filter (¥d -> m `mod` d == 0 && n <= m `div` d) (map (truncate (sqrt (fromIntegral m)) -) [0..])
               