from collections import deque

 

def dfs(n, start, graph):

  visited = [False] * n

  stack = deque()

  stack.append(start)

  visited[start] = True

  while stack:

    q = stack.popleft()

    nxts = graph[q]

    for nxt in nxts:

      if not visited[nxt]:

        visited[nxt] = True

        stack.append(nxt)

  return visited

 

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

edge = [list(map(int, input().split())) for _ in range(m)]

 

ans = 0

for i in range(m):

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

  for itr, (a, b) in enumerate(edge):

    if itr != i:

      graph[a - 1].append(b - 1)

      graph[b - 1].append(a - 1)

 

  if not all(dfs(n, 0, graph)):

    ans += 1

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

edge=[[] for _ in range(n+1)]

eab=[]

for i in range(m):

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

    edge[a-1].append(b-1)

    edge[b-1].append(a-1)

    eab.append([a-1,b-1])

 

def dfs(visited,count,node):

    visited[node]=True

    count+=1

    ev=edge[node]

    for node in ev:

        if visited[node]:

            continue

        else:

            count=dfs(visited,count,node)

    return count



ans=0

for i in range(m):

    a,b=eab[i]

    edge[a].remove(b)

    edge[b].remove(a)

    ci=dfs([False for _ in range(n)],0,0)

    if ci!=n:

        ans+=1

    edge[a].append(b)

    edge[b].append(a)

print(ans)
from collections import deque


def dfs(n, start, graph):
    visited = [False] * n
    stack = deque()
    stack.append(start)
    visited[start] = True
    while stack:
        q = stack.popleft()
        nxts = graph[q]
        for nxt in nxts:
            if not visited[nxt]:
                visited[nxt] = True
                stack.append(nxt)
    return visited


n, m = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(m)]
ans = 0
for i in range(m):
    graph = [[] for _ in range(n)]
    for itr, (a, b) in enumerate(edge):
        if itr != i:
            graph[a - 1].append(b - 1)
            graph[b - 1].append(a - 1)
    if not all(dfs(n, 0, graph)):
        ans += 1
print(ans)

n, m = list(map(int, input().split()))
edge = [[] for _ in range(n + 1)]
eab = []
for i in range(m):
    a, b = list(map(int, input().split()))
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)
    eab.append([a - 1, b - 1])


def dfs(visited, count, node):
    visited[node] = True
    count += 1
    ev = edge[node]
    for node in ev:
        if visited[node]:
            continue
        else:
            count = dfs(visited, count, node)
    return count


ans = 0
for i in range(m):
    a, b = eab[i]
    edge[a].remove(b)
    edge[b].remove(a)
    ci = dfs([False for _ in range(n)], 0, 0)
    if ci != n:
        ans += 1
    edge[a].append(b)
    edge[b].append(a)
print(ans)

-from collections import deque +n, m = list(map(int, input().split())) +edge = [[] for _ in range(n + 1)] +eab = [] +for i in range(m): +    a, b = list(map(int, input().split())) +    edge[a - 1].append(b - 1) +    edge[b - 1].append(a - 1) +    eab.append([a - 1, b - 1]) -def dfs(n, start, graph): -    visited = [False] * n -    stack = deque() -    stack.append(start) -    visited[start] = True -    while stack: -        q = stack.popleft() -        nxts = graph[q] -        for nxt in nxts: -            if not visited[nxt]: -                visited[nxt] = True -                stack.append(nxt) -    return visited +def dfs(visited, count, node): +    visited[node] = True +    count += 1 +    ev = edge[node] +    for node in ev: +        if visited[node]: +            continue +        else: +            count = dfs(visited, count, node) +    return count -n, m = list(map(int, input().split())) -edge = [list(map(int, input().split())) for _ in range(m)] -    graph = [[] for _ in range(n)] -    for itr, (a, b) in enumerate(edge): -        if itr != i: -            graph[a - 1].append(b - 1) -            graph[b - 1].append(a - 1) -    if not all(dfs(n, 0, graph)): +    a, b = eab[i] +    edge[a].remove(b) +    edge[b].remove(a) +    ci = dfs([False for _ in range(n)], 0, 0) +    if ci != n: +    edge[a].append(b) +    edge[b].append(a)