import Control.Monad
import Data.List
main = do
 [n,m]<-map read . words <$> getLine
 asbs <- replicateM m $ map (read::String-> Int) .words <$> getLine
 print $ length ['a'|k<-[1..m], connected 1 (cut k asbs)]
 
next::Int->[[Int]]->[Int]
next v es = nub [b|[a,b]<-(es ++ reverse es), a == v]
nexts::[Int]->[[Int]]->[Int]
nexts vs es = sort .nub (vs ++ concat [next w es|w<-vs])
reach vs es
	|next vs es == next (next vs es) es =next vs es
    |otherwise =reach (next vs es) es
reachable v es = reach [v] es
connected v es = length (reachable v es) == n
cut k es = (take (k-1) es) ++ (drop k es) 