import qualified Data.Map as M
import Data.Maybe
import Data.Ord (Down(..))
import Data.List

tuplify (a:b:_) = (a, b)

updateGraph :: (Int, Int) -> M.Map Int [Int] -> M.Map Int [Int]
updateGraph (s, t) m = M.insert s (t:ts) m
	where ts = fromMaybe [] $ M.lookup s m
toGraph sts = reverse $ map (sortOn Down . snd) $ M.toList $ foldr updateGraph M.empty sts

renumber n st = n - st - 1

average :: (Fractional a) => [a] -> a
average [] = 0
average xs = sum' / fromIntegral count
	where
		(sum', count) = foldr sumCount (0, 0) xs
		sumCount x (sum', count) = (sum' + x, count + 1)

toPluggedProbability' :: [Double] -> Int -> [[Int]] -> [Double]
toPluggedProbability' probs _ [] = probs
toPluggedProbability' probs n (g:gs) = toPluggedProbability' newProbs (n - 1) gs
	where
		toProb (-1) = 0
		toProb t  = probs !! t
		newProbs = if n == 0
			then probs ++ [1 + (average $ tail $ sortOn Down (map toProb g))]
			else probs ++ [1 + average (map toProb g)]

toPluggedProbability :: [[Int]] -> Int -> Maybe [Double]
toPluggedProbability gs n = if length (gs !! n) >= 2
	then Just $ toPluggedProbability' [] n gs
	else Nothing

toProbability' :: [Double] -> [[Int]] -> [Double]
toProbability' probs [] = probs
toProbability' probs (g:gs) = toProbability' newProbs gs
	where
		toProb (-1) = 0
		toProb t  = probs !! t
		newProbs = probs ++ [1 + average (map toProb g)]

toProbability = toProbability' []

main :: IO ()
main = do
	[n, m] <- map read . words <$> getLine
	sts <- map (tuplify . map read . words) . take m . lines <$> getContents
	let baseGraph = map (map (n - 1 -)) $ toGraph sts
	let graphs = baseGraph
	let results' = (Just $ toProbability baseGraph) : [toPluggedProbability baseGraph l | l <- [0..(n - 2)]]
	let results = map last $ catMaybes results'
	print $ minimum results
