import Data.Array
import Data.Array.ST
import Control.Monad.ST
import Control.Monad

type Edges = Array Int (Int,Int)
type Nodes = Array Int [Int]
type Graph = (Nodes,Edges)

edge_to_node::(Int,Int)->Edges->Nodes
edge_to_node (i,f) edges = runSTArray $ do
                        ar<-newArray (i,f) []
                        let (i_e,f_e) = bounds edges
                        forM_ [i_e..f_e] (\i-> do
                                              let (a,b) = edges!i
                                              e_a<-readArray ar a
                                              writeArray ar a (i:e_a)
                                              e_b<-readArray ar b
                                              writeArray ar b (i:e_b))
                        return ar


--ノード数、除外する辺id、グラフ、全探索できたらTrue
dfs_except_i::Int->Int->Graph->Bool
dfs_except_i n i graph =(and.elems) (runSTArray $ do
                        flags<-newArray (1,n) False　
                        rec_except_i graph i 1 flags
                        return flags)

--グラフ　除外辺、現在ノード、到達フラグアレイ、アクション
rec_except_i::Graph->Int->Int->STArray s Int Bool->ST s ()
rec_except_i (nodes,edges) i n flags =do
  b<-readArray flags n
  case b of
    True  -> return ()
    False -> do
      writeArray flags n True
      let neighbor_edges = filter (i/=) (nodes!n)
      let next_nodes = map (\(a,b)->if a==n then b else a) [edges!j|j<-neighbor_edges]
      forM_ next_nodes (\ m -> rec_except_i (nodes,edges) i m flags)


main::IO()
main=do
  nmc<-getLine
  let n:m:[]=map read (words nmc)
  ss<-forM [1..m] (\_ -> getLine)
  let edges = listArray (1,m) (map (\s->let a:b:[]= map read (words s)in (a,b)) ss)
  let nodes = edge_to_node (1,n) edges
  print (m-((length.(filter (\i ->(dfs_except_i n i (nodes,edges))))) [1..m]))