import copy

        

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



class UnionFindPathCompression():

    def __init__(self, n:int):

        self.parents = list(range(n))

        self.rank = [1]*n

        self.size = [1]*n

        



    def find(self, x:int) -> int:

        if self.parents[x] == x:

            return x

        else:

            self.parents[x] = self.find(self.parents[x])

            return self.parents[x]



    def union(self, x:int, y:int):

        px = self.find(x)

        py = self.find(y)



        if px == py:

            return

        else:

            if self.rank[px] < self.rank[py]:

                self.parents[px] = py

                self.size[py] += self.size[px]

            else:

                self.parents[py] = px

                self.size[px] += self.size[py]

                #ランクの更新

                if self.rank[px] == self.rank[py]:

                    self.rank[px] += 1





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

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

memo = 0

for i in range(m):

    ufpc = UnionFindPathCompression(n)

    ab_copy = copy.deepcopy(ab)

    ab_copy.pop(i)

    for a,b in ab_copy:

        a,b = a-1,b-1

        ufpc.union(a,b)

    for i in range(n):

        ufpc.find(i)

    check = set(ufpc.parents)

    if len(check)==1:

        memo += 1

print((m-memo))
import copy

        

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



class UnionFindPathCompression():

    def __init__(self, n:int):

        self.parents = list(range(n))

        self.rank = [1]*n

        self.size = [1]*n

        



    def find(self, x:int) -> int:

        if self.parents[x] == x:

            return x

        else:

            self.parents[x] = self.find(self.parents[x])

            return self.parents[x]



    def union(self, x:int, y:int):

        px = self.find(x)

        py = self.find(y)



        if px == py:

            return

        else:

            if self.rank[px] < self.rank[py]:

                self.parents[px] = py

                self.size[py] += self.size[px]

            else:

                self.parents[py] = px

                self.size[px] += self.size[py]

                #ランクの更新

                if self.rank[px] == self.rank[py]:

                    self.rank[px] += 1





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

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

ans = 0

for i in range(m):

    ufpc = UnionFindPathCompression(n)

    ab_copy = copy.deepcopy(ab)

    ab_copy.pop(i)

    for a,b in ab_copy:

        a,b = a-1,b-1

        ufpc.union(a,b)

    for i in range(n):

        ufpc.find(i)

    check = set(ufpc.parents)

    if len(check) != 1:

        ans += 1

print(ans)

        
import copy
import sys

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


class UnionFindPathCompression:
    def __init__(self, n: int):
        self.parents = list(range(n))
        self.rank = [1] * n
        self.size = [1] * n

    def find(self, x: int) -> int:
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x: int, y: int):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        else:
            if self.rank[px] < self.rank[py]:
                self.parents[px] = py
                self.size[py] += self.size[px]
            else:
                self.parents[py] = px
                self.size[px] += self.size[py]
                # ランクの更新
                if self.rank[px] == self.rank[py]:
                    self.rank[px] += 1


n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
memo = 0
for i in range(m):
    ufpc = UnionFindPathCompression(n)
    ab_copy = copy.deepcopy(ab)
    ab_copy.pop(i)
    for a, b in ab_copy:
        a, b = a - 1, b - 1
        ufpc.union(a, b)
    for i in range(n):
        ufpc.find(i)
    check = set(ufpc.parents)
    if len(check) == 1:
        memo += 1
print((m - memo))

import copy
import sys

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


class UnionFindPathCompression:
    def __init__(self, n: int):
        self.parents = list(range(n))
        self.rank = [1] * n
        self.size = [1] * n

    def find(self, x: int) -> int:
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x: int, y: int):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        else:
            if self.rank[px] < self.rank[py]:
                self.parents[px] = py
                self.size[py] += self.size[px]
            else:
                self.parents[py] = px
                self.size[px] += self.size[py]
                # ランクの更新
                if self.rank[px] == self.rank[py]:
                    self.rank[px] += 1


n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ans = 0
for i in range(m):
    ufpc = UnionFindPathCompression(n)
    ab_copy = copy.deepcopy(ab)
    ab_copy.pop(i)
    for a, b in ab_copy:
        a, b = a - 1, b - 1
        ufpc.union(a, b)
    for i in range(n):
        ufpc.find(i)
    check = set(ufpc.parents)
    if len(check) != 1:
        ans += 1
print(ans)

-memo = 0 +ans = 0 -    if len(check) == 1: -        memo += 1 -print((m - memo)) +    if len(check) != 1: +        ans += 1 +print(ans)