program prob5
    implicit none
    integer :: N, M, i, j, ans, cnt
    integer, allocatable :: a(:), b(:)
    integer, allocatable :: v(:)
    read(*,*) N, M
    allocate(a(M))
    allocate(b(M))
    allocate(v(N))

    do i = 1, M
        read(*,*) a(i), b(i)
    end do
    
    ans = 0
    do i = 1, M
        do j = 1, N
            v(j) = j
        end do
        cnt = N
        do j = 1, M
            if(i == j)then
                cycle
            end if
            if(UFsame(v, a(j), b(j)) .eqv. .false.) then
                cnt = cnt - 1
                call UFunite(v, a(j), b(j))
            end if
        end do

        if(cnt /= 1) then
            ans = ans + 1
        end if

    end do

    write(*,*) ans


    deallocate(b)
    deallocate(a)
    deallocate(v)



    stop
contains
recursive integer function UFroot(v, x) result(r)
    implicit none
    integer :: v(:)
    integer :: x
    if(v(x) == x) then
        r = x
    else
        v(x) = UFroot(v, v(x))
        r = v(x)
    end if
    return
end function UFroot

subroutine UFunite(v, x, y)
    implicit none
    integer :: v(:)
    integer :: x, y
    integer :: rx, ry
    rx = UFroot(v, x)
    ry = UFroot(v, y)
    if(rx == ry) return
    v(rx) = ry
    return
end subroutine UFunite

logical function UFsame(v, x, y) result(r)
    implicit none
    integer :: v(:)
    integer :: x, y
    integer :: rx, ry
    rx = UFroot(v, x)
    ry = UFroot(v, y)
    if(rx == ry) then
        r = .true.
    else
        r = .false.
    end if    
    return
end function UFsame



end program prob5