import copy



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

array = [[int(x) for x in input().split()] for y in range(m)]

t = copy.copy(array)





def solver(start, array, visited, cnt):

    if visited[start]:

        return cnt

    else:

        visited[start] = True



    for i in array[start]:

        if len(set(visited)) == 1:

            return 1

        else:

            cnt = solver(i, array, visited, cnt)



    return cnt





res2 = 0

for i in range(m):

    tmp = array[:i] + array[i + 1:]

    modify = [[] for x in range(n + 1)]

    for value1, value2 in tmp:

        modify[value1].append(value2)

        modify[value2].append(value1)



    visited = [False if x != 0 and x != 1 else True for x in range(n + 1)]

    if not modify[1]:

        continue



    res = 0

    for i in modify[1]:

        res += solver(i, modify, visited, 0)

    else:

        res2 += 1 if res > 0 else 0



print((m - res2))

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

ab_array = [[int(x) for x in input().split()] for y in range(m)]

graph = [[] for x in range(n + 1)]





def dfs(graph, now, a, b):

    visited[now] = True

    for next in graph[now]:

        if (now == a and next == b) or (now == b and next == a):

            continue

        if not visited[next]:

            dfs(graph, next, a, b)

    return visited.count(False) == 1





for a, b in ab_array:

    graph[a].append(b)

    graph[b].append(a)

ans = 0

for a, b in ab_array:

    start = a

    end = b

    visited = [False for x in range(n + 1)]

    if dfs(graph, 1, a, b):

        ans += 1

print((m - ans))

import copy

n, m = list(map(int, input().split()))
array = [[int(x) for x in input().split()] for y in range(m)]
t = copy.copy(array)


def solver(start, array, visited, cnt):
    if visited[start]:
        return cnt
    else:
        visited[start] = True
    for i in array[start]:
        if len(set(visited)) == 1:
            return 1
        else:
            cnt = solver(i, array, visited, cnt)
    return cnt


res2 = 0
for i in range(m):
    tmp = array[:i] + array[i + 1 :]
    modify = [[] for x in range(n + 1)]
    for value1, value2 in tmp:
        modify[value1].append(value2)
        modify[value2].append(value1)
    visited = [False if x != 0 and x != 1 else True for x in range(n + 1)]
    if not modify[1]:
        continue
    res = 0
    for i in modify[1]:
        res += solver(i, modify, visited, 0)
    else:
        res2 += 1 if res > 0 else 0
print((m - res2))

n, m = list(map(int, input().split()))
ab_array = [[int(x) for x in input().split()] for y in range(m)]
graph = [[] for x in range(n + 1)]


def dfs(graph, now, a, b):
    visited[now] = True
    for next in graph[now]:
        if (now == a and next == b) or (now == b and next == a):
            continue
        if not visited[next]:
            dfs(graph, next, a, b)
    return visited.count(False) == 1


for a, b in ab_array:
    graph[a].append(b)
    graph[b].append(a)
ans = 0
for a, b in ab_array:
    start = a
    end = b
    visited = [False for x in range(n + 1)]
    if dfs(graph, 1, a, b):
        ans += 1
print((m - ans))

-import copy - -array = [[int(x) for x in input().split()] for y in range(m)] -t = copy.copy(array) +ab_array = [[int(x) for x in input().split()] for y in range(m)] +graph = [[] for x in range(n + 1)] -def solver(start, array, visited, cnt): -    if visited[start]: -        return cnt -    else: -        visited[start] = True -    for i in array[start]: -        if len(set(visited)) == 1: -            return 1 -        else: -            cnt = solver(i, array, visited, cnt) -    return cnt +def dfs(graph, now, a, b): +    visited[now] = True +    for next in graph[now]: +        if (now == a and next == b) or (now == b and next == a): +            continue +        if not visited[next]: +            dfs(graph, next, a, b) +    return visited.count(False) == 1 -res2 = 0 -for i in range(m): -    tmp = array[:i] + array[i + 1 :] -    modify = [[] for x in range(n + 1)] -    for value1, value2 in tmp: -        modify[value1].append(value2) -        modify[value2].append(value1) -    visited = [False if x != 0 and x != 1 else True for x in range(n + 1)] -    if not modify[1]: -        continue -    res = 0 -    for i in modify[1]: -        res += solver(i, modify, visited, 0) -    else: -        res2 += 1 if res > 0 else 0 -print((m - res2)) +for a, b in ab_array: +    graph[a].append(b) +    graph[b].append(a) +ans = 0 +for a, b in ab_array: +    start = a +    end = b +    visited = [False for x in range(n + 1)] +    if dfs(graph, 1, a, b): +        ans += 1 +print((m - ans))