from heapq import heappush, heappop

from itertools import permutations, accumulate, combinations

import math

import bisect

import numpy as np

from collections import defaultdict, deque

import sys

input = sys.stdin.readline

# sys.setrecursionlimit(1000000)

# MOD = 10 ** 9 + 7

# INF = float("inf")





def bfs(s, n, g):

    que = deque([])

    que.append(s)

    check = [-1] * n

    check[s] = 0

    while que:

        u = que.popleft()

        for v in g[u]:

            if check[v] == -1:

                check[v] = check[u] + 1

                que.append(v)

    if -1 in check:

        return True

    else:

        return False





def main():

    n, m = list(map(int, input().split()))

    g = [[] for _ in range(n)]

    gg = deque([])

    for _ in range(m):

        a, b = [int(i) - 1 for i in input().split()]

        g[a].append(b)

        g[b].append(a)

        gg.append((a, b))

    ans = 0

    for i in range(m):

        a, b = gg.popleft()

        g[a].remove(b)

        g[b].remove(a)

        if bfs(0, n, g):

            ans += 1

        g[a].append(b)

        g[b].append(a)

    print(ans)





if __name__ == "__main__":

    main()
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**6)

# MOD = 10 ** 9 + 7

# INF = float("inf")





def dfs(start, a, b, visited, n, graph):

    for node in graph[start]:

        if node not in visited:

            if (start, node) == (a, b) or (start, node) == (b, a):

                continue  # (start, node)がなくなっている場合を考えるので，このケースはスルーする

            else:

                visited.append(node)

                dfs(node, a, b, visited, n, graph)

    if len(visited) == n:

        return 0

    else:

        return 1





def main():

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

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

    edge = []

    for _ in range(M):

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

        a, b = a - 1, b - 1

        graph[a].append(b)

        graph[b].append(a)

        edge.append((a, b))

    cnt = 0

    for a, b in edge:

        cnt += dfs(0, a, b, [], N, graph)

    print(cnt)





if __name__ == '__main__':

    main()
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys

input = sys.stdin.readline
# sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def bfs(s, n, g):
    que = deque([])
    que.append(s)
    check = [-1] * n
    check[s] = 0
    while que:
        u = que.popleft()
        for v in g[u]:
            if check[v] == -1:
                check[v] = check[u] + 1
                que.append(v)
    if -1 in check:
        return True
    else:
        return False


def main():
    n, m = list(map(int, input().split()))
    g = [[] for _ in range(n)]
    gg = deque([])
    for _ in range(m):
        a, b = [int(i) - 1 for i in input().split()]
        g[a].append(b)
        g[b].append(a)
        gg.append((a, b))
    ans = 0
    for i in range(m):
        a, b = gg.popleft()
        g[a].remove(b)
        g[b].remove(a)
        if bfs(0, n, g):
            ans += 1
        g[a].append(b)
        g[b].append(a)
    print(ans)


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def dfs(start, a, b, visited, n, graph):
    for node in graph[start]:
        if node not in visited:
            if (start, node) == (a, b) or (start, node) == (b, a):
                continue  # (start, node)がなくなっている場合を考えるので，このケースはスルーする
            else:
                visited.append(node)
                dfs(node, a, b, visited, n, graph)
    if len(visited) == n:
        return 0
    else:
        return 1


def main():
    N, M = list(map(int, input().split()))
    graph = [[] for _ in range(N)]
    edge = []
    for _ in range(M):
        a, b = list(map(int, input().split()))
        a, b = a - 1, b - 1
        graph[a].append(b)
        graph[b].append(a)
        edge.append((a, b))
    cnt = 0
    for a, b in edge:
        cnt += dfs(0, a, b, [], N, graph)
    print(cnt)


if __name__ == "__main__":
    main()

-from heapq import heappush, heappop -from itertools import permutations, accumulate, combinations -import math -import bisect -import numpy as np -from collections import defaultdict, deque -# sys.setrecursionlimit(1000000) +sys.setrecursionlimit(10**6) -def bfs(s, n, g): -    que = deque([]) -    que.append(s) -    check = [-1] * n -    check[s] = 0 -    while que: -        u = que.popleft() -        for v in g[u]: -            if check[v] == -1: -                check[v] = check[u] + 1 -                que.append(v) -    if -1 in check: -        return True +def dfs(start, a, b, visited, n, graph): +    for node in graph[start]: +        if node not in visited: +            if (start, node) == (a, b) or (start, node) == (b, a): +                continue  # (start, node)がなくなっている場合を考えるので，このケースはスルーする +            else: +                visited.append(node) +                dfs(node, a, b, visited, n, graph) +    if len(visited) == n: +        return 0 -        return False +        return 1 -    n, m = list(map(int, input().split())) -    g = [[] for _ in range(n)] -    gg = deque([]) -    for _ in range(m): -        a, b = [int(i) - 1 for i in input().split()] -        g[a].append(b) -        g[b].append(a) -        gg.append((a, b)) -    ans = 0 -    for i in range(m): -        a, b = gg.popleft() -        g[a].remove(b) -        g[b].remove(a) -        if bfs(0, n, g): -            ans += 1 -        g[a].append(b) -        g[b].append(a) -    print(ans) +    N, M = list(map(int, input().split())) +    graph = [[] for _ in range(N)] +    edge = [] +    for _ in range(M): +        a, b = list(map(int, input().split())) +        a, b = a - 1, b - 1 +        graph[a].append(b) +        graph[b].append(a) +        edge.append((a, b)) +    cnt = 0 +    for a, b in edge: +        cnt += dfs(0, a, b, [], N, graph) +    print(cnt)