import sys

from collections import deque



input = sys.stdin.readline





def dfs(G, v, visited):

    visited[v] = True

    stack = deque([v])

    while stack:

        v = stack.pop()

        for u in G[v]:

            if visited[u]:

                continue

            visited[u] = True

            stack.append(u)





def main():

    N, M = list(map(int, input().split()))

    G = [[] for _ in range(N)]

    a = [0] * M

    b = [0] * M

    for i in range(M):

        a[i], b[i] = list(map(int, input().split()))

        a[i] -= 1

        b[i] -= 1

        G[a[i]].append(b[i])

        G[b[i]].append(a[i])



    ans = 0

    for i in range(M):

        G[a[i]].remove(b[i])

        G[b[i]].remove(a[i])



        visited = [False] * N

        dfs(G, 0, visited)



        if not all(visited):

            ans += 1



        G[a[i]].append(b[i])

        G[b[i]].append(a[i])



    print(ans)





if __name__ == "__main__":

    main()

import sys

input = sys.stdin.readline  # NOQA

sys.setrecursionlimit(10 ** 7)  # NOQA





def dfs(G, v, visited):

    """G: graph, v: vertex"""

    visited[v] = True

    for c in G[v]:

        if visited[c]:

            continue

        dfs(G, c, visited)





def main():

    N, M = list(map(int, input().split()))

    a = [None] * M

    b = [None] * M

    G = [[] for _ in range(N)]

    for i in range(M):

        a[i], b[i] = list(map(int, input().split()))

        a[i] -= 1

        b[i] -= 1

        G[a[i]].append(b[i])

        G[b[i]].append(a[i])



    ans = 0

    for i in range(M):

        # remove an adge

        G[a[i]].remove(b[i])

        G[b[i]].remove(a[i])



        visited = [False] * N

        visited[0] = True

        dfs(G, 0, visited)



        if visited.count(True) != N:

            ans += 1



        # restore an edge

        G[a[i]].append(b[i])

        G[b[i]].append(a[i])



    print(ans)





if __name__ == "__main__":

    main()

import sys
from collections import deque

input = sys.stdin.readline


def dfs(G, v, visited):
    visited[v] = True
    stack = deque([v])
    while stack:
        v = stack.pop()
        for u in G[v]:
            if visited[u]:
                continue
            visited[u] = True
            stack.append(u)


def main():
    N, M = list(map(int, input().split()))
    G = [[] for _ in range(N)]
    a = [0] * M
    b = [0] * M
    for i in range(M):
        a[i], b[i] = list(map(int, input().split()))
        a[i] -= 1
        b[i] -= 1
        G[a[i]].append(b[i])
        G[b[i]].append(a[i])
    ans = 0
    for i in range(M):
        G[a[i]].remove(b[i])
        G[b[i]].remove(a[i])
        visited = [False] * N
        dfs(G, 0, visited)
        if not all(visited):
            ans += 1
        G[a[i]].append(b[i])
        G[b[i]].append(a[i])
    print(ans)


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline  # NOQA
sys.setrecursionlimit(10**7)  # NOQA


def dfs(G, v, visited):
    """G: graph, v: vertex"""
    visited[v] = True
    for c in G[v]:
        if visited[c]:
            continue
        dfs(G, c, visited)


def main():
    N, M = list(map(int, input().split()))
    a = [None] * M
    b = [None] * M
    G = [[] for _ in range(N)]
    for i in range(M):
        a[i], b[i] = list(map(int, input().split()))
        a[i] -= 1
        b[i] -= 1
        G[a[i]].append(b[i])
        G[b[i]].append(a[i])
    ans = 0
    for i in range(M):
        # remove an adge
        G[a[i]].remove(b[i])
        G[b[i]].remove(a[i])
        visited = [False] * N
        visited[0] = True
        dfs(G, 0, visited)
        if visited.count(True) != N:
            ans += 1
        # restore an edge
        G[a[i]].append(b[i])
        G[b[i]].append(a[i])
    print(ans)


if __name__ == "__main__":
    main()

-from collections import deque -input = sys.stdin.readline +input = sys.stdin.readline  # NOQA +sys.setrecursionlimit(10**7)  # NOQA +    """G: graph, v: vertex""" -    stack = deque([v]) -    while stack: -        v = stack.pop() -        for u in G[v]: -            if visited[u]: -                continue -            visited[u] = True -            stack.append(u) +    for c in G[v]: +        if visited[c]: +            continue +        dfs(G, c, visited) +    a = [None] * M +    b = [None] * M -    a = [0] * M -    b = [0] * M +        # remove an adge +        visited[0] = True -        if not all(visited): +        if visited.count(True) != N: +        # restore an edge