from copy import deepcopy

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

graph = dict()

for i in range(N):

    graph[i] = []

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



import numpy as np

from scipy.sparse.csgraph import shortest_path

from scipy.sparse import csr_matrix

inf = float("inf")



graph = np.zeros((N, N))



for a, b in ab:

    graph[a - 1][b - 1] = 1

counter = 0

for a, b in ab:

    g = deepcopy(graph)

    g[a - 1][b - 1] = 0

    g = csr_matrix(g)

    shortest_paths = shortest_path(g, directed=False, method="D")

    if inf in shortest_paths[0]:

        counter += 1

print(counter)

class UnionFind():

    def __init__(self, n):

        self.n = n

        self.parents = [-1] * n



    def find(self, x):

        if self.parents[x] < 0:

            return x

        else:

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

            return self.parents[x]



    def union(self, x, y):

        x = self.find(x)

        y = self.find(y)



        if x == y:

            return



        if self.parents[x] > self.parents[y]:

            x, y = y, x



        self.parents[x] += self.parents[y]

        self.parents[y] = x



    def size(self, x):

        return -self.parents[self.find(x)]



    def same(self, x, y):

        return self.find(x) == self.find(y)



    def members(self, x):

        root = self.find(x)

        return [i for i in range(self.n) if self.find(i) == root]



    def roots(self):

        return [i for i, x in enumerate(self.parents) if x < 0]



    def group_count(self):

        return len(self.roots())



    def all_group_members(self):

        return {r: self.members(r) for r in self.roots()}



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

def int_(num):

    return int(num) - 1

ablist = [list(map(int_, input().split())) for _ in range(M)]

ans = 0

for ng in range(M):

    uf = UnionFind(N)

    for i in range(M):

        if i != ng:

            uf.union(*ablist[i])

    if uf.group_count() != 1:

        ans += 1

print(ans)
from copy import deepcopy

N, M = list(map(int, input().split()))
graph = dict()
for i in range(N):
    graph[i] = []
ab = [tuple(map(int, input().split())) for _ in range(M)]
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix

inf = float("inf")
graph = np.zeros((N, N))
for a, b in ab:
    graph[a - 1][b - 1] = 1
counter = 0
for a, b in ab:
    g = deepcopy(graph)
    g[a - 1][b - 1] = 0
    g = csr_matrix(g)
    shortest_paths = shortest_path(g, directed=False, method="D")
    if inf in shortest_paths[0]:
        counter += 1
print(counter)

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


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


def int_(num):
    return int(num) - 1


ablist = [list(map(int_, input().split())) for _ in range(M)]
ans = 0
for ng in range(M):
    uf = UnionFind(N)
    for i in range(M):
        if i != ng:
            uf.union(*ablist[i])
    if uf.group_count() != 1:
        ans += 1
print(ans)

-from copy import deepcopy +class UnionFind: +    def __init__(self, n): +        self.n = n +        self.parents = [-1] * n + +    def find(self, x): +        if self.parents[x] < 0: +            return x +        else: +            self.parents[x] = self.find(self.parents[x]) +            return self.parents[x] + +    def union(self, x, y): +        x = self.find(x) +        y = self.find(y) +        if x == y: +            return +        if self.parents[x] > self.parents[y]: +            x, y = y, x +        self.parents[x] += self.parents[y] +        self.parents[y] = x + +    def size(self, x): +        return -self.parents[self.find(x)] + +    def same(self, x, y): +        return self.find(x) == self.find(y) + +    def members(self, x): +        root = self.find(x) +        return [i for i in range(self.n) if self.find(i) == root] + +    def roots(self): +        return [i for i, x in enumerate(self.parents) if x < 0] + +    def group_count(self): +        return len(self.roots()) + +    def all_group_members(self): +        return {r: self.members(r) for r in self.roots()} + -graph = dict() -for i in range(N): -    graph[i] = [] -ab = [tuple(map(int, input().split())) for _ in range(M)] -import numpy as np -from scipy.sparse.csgraph import shortest_path -from scipy.sparse import csr_matrix -inf = float("inf") -graph = np.zeros((N, N)) -for a, b in ab: -    graph[a - 1][b - 1] = 1 -counter = 0 -for a, b in ab: -    g = deepcopy(graph) -    g[a - 1][b - 1] = 0 -    g = csr_matrix(g) -    shortest_paths = shortest_path(g, directed=False, method="D") -    if inf in shortest_paths[0]: -        counter += 1 -print(counter) + +def int_(num): +    return int(num) - 1 + + +ablist = [list(map(int_, input().split())) for _ in range(M)] +ans = 0 +for ng in range(M): +    uf = UnionFind(N) +    for i in range(M): +        if i != ng: +            uf.union(*ablist[i]) +    if uf.group_count() != 1: +        ans += 1 +print(ans)