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

main = sol <$> gett >>= print

gett = unfoldr (runStateT $ (,) <$> geti <*> geti) <$> C.getContents

geti = coerce $ C.readInt . C.dropWhile (<'0') :: StateT C.ByteString Maybe Int

sol ((n,m):es) = length $ filter brdg [0..m-1]
  where
  brdg i = not $ path g u v
    where
    (u,v) = es!!i
    g = buildG (1,n) . concatMap (\(u,v) -> [(u,v),(v,u)]) $ es \\ [(u,v)]