import Control.Monad
import qualified Data.ByteString.Char8 as C
import Data.Graph
import Data.List

main = sub =<< get

sub [n,m] = sol n m <$> replicateM m get >>= print

get = unfoldr (C.readInt . C.dropWhile (<'0')) <$> C.getLine 

sol n m es = length $ filter brdg ess
  where
  ess = map (\i -> es\\[es!!i]) [0..m-1]
  brdg = (>1) . length . dff . buildG (1,n) . concatMap (\[u,v] -> [(u,v),(v,u)])