from collections import defaultdict

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

G = defaultdict(list)

s = []

for i in range(m):

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

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

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

    s.append((a - 1, b - 1))





def dfs(cur, pre, NG, k):

    global used

    used[cur] = 1

    for v in G[cur]:

        if v != pre and used[v] != 1 and (v, cur) != NG and (cur, v) != NG:

            dfs(v, cur, NG, k + 1)





num = 0

for i in range(m):

    ng = s[i]

    used = [0] * n

    used[0] = 1

    dfs(0, -1, ng, 0)

    if sum(used) == n:

        num += 1



print((m - num))
N, M = list(map(int, input().split()))

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

E = []

for i in range(M):

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

    a, b = a - 1, b - 1

    G[a].append(b)

    G[b].append(a)

    E.append((a, b))





def dfs(v, pre, s, ng):

    if used[v]:

        return

    used[v] = 1

    s.add(v)

    for u in G[v]:

        if u == pre:

            continue

        if (u, v) != ng and (v, u) != ng:

            dfs(u, v, s, ng)

    return





num = 0

for i in E:

    used = [0] * N

    s = set()

    dfs(0, -1, s, i)

    if len(s) == N:

        num += 1



print((M - num))

from collections import defaultdict

n, m = list(map(int, input().split()))
G = defaultdict(list)
s = []
for i in range(m):
    a, b = list(map(int, input().split()))
    G[a - 1].append(b - 1)
    G[b - 1].append(a - 1)
    s.append((a - 1, b - 1))


def dfs(cur, pre, NG, k):
    global used
    used[cur] = 1
    for v in G[cur]:
        if v != pre and used[v] != 1 and (v, cur) != NG and (cur, v) != NG:
            dfs(v, cur, NG, k + 1)


num = 0
for i in range(m):
    ng = s[i]
    used = [0] * n
    used[0] = 1
    dfs(0, -1, ng, 0)
    if sum(used) == n:
        num += 1
print((m - num))

N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
E = []
for i in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    G[a].append(b)
    G[b].append(a)
    E.append((a, b))


def dfs(v, pre, s, ng):
    if used[v]:
        return
    used[v] = 1
    s.add(v)
    for u in G[v]:
        if u == pre:
            continue
        if (u, v) != ng and (v, u) != ng:
            dfs(u, v, s, ng)
    return


num = 0
for i in E:
    used = [0] * N
    s = set()
    dfs(0, -1, s, i)
    if len(s) == N:
        num += 1
print((M - num))

-from collections import defaultdict - -n, m = list(map(int, input().split())) -G = defaultdict(list) -s = [] -for i in range(m): +N, M = list(map(int, input().split())) +G = [[] for i in range(N)] +E = [] +for i in range(M): -    G[a - 1].append(b - 1) -    G[b - 1].append(a - 1) -    s.append((a - 1, b - 1)) +    a, b = a - 1, b - 1 +    G[a].append(b) +    G[b].append(a) +    E.append((a, b)) -def dfs(cur, pre, NG, k): -    global used -    used[cur] = 1 -    for v in G[cur]: -        if v != pre and used[v] != 1 and (v, cur) != NG and (cur, v) != NG: -            dfs(v, cur, NG, k + 1) +def dfs(v, pre, s, ng): +    if used[v]: +        return +    used[v] = 1 +    s.add(v) +    for u in G[v]: +        if u == pre: +            continue +        if (u, v) != ng and (v, u) != ng: +            dfs(u, v, s, ng) +    return -for i in range(m): -    ng = s[i] -    used = [0] * n -    used[0] = 1 -    dfs(0, -1, ng, 0) -    if sum(used) == n: +for i in E: +    used = [0] * N +    s = set() +    dfs(0, -1, s, i) +    if len(s) == N: -print((m - num)) +print((M - num))