program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n,ans
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:),z(:)
  
    read(*,*) n,m
    allocate(x(m),y(m),z(n))
    do i=1,m
        read(*,*)x(i),y(i)
    end do
    z(:)=0
    do i=1,m
        z(x(i))=z(x(i))+1
        z(y(i))=z(y(i))+1
    end do

    do i=1,m+2
        a=0
        do j=1,m
            
            if(x(j)==0)then
                cycle
            elseif(z(x(j))==1 .or. z(y(j))==1 )then
                z(x(j))=z(x(j))-1
                z(y(j))=z(y(j))-1
                ans=ans+1
                x(j)=0
                y(j)=0
                a=1
            end if
        end do
        if(a==0)then
            write(*,*)ans
            stop
        end if

    end do

    stop
end program sample
  

