findFactor :: Int -> Int -> Int findFactor n k = head [ n `div` i | i <- [2 .. k] , n `mod` i == 0] main :: IO () main = do [n, k] <- mapM readIO . words =<< getLine print $ findFactor n k