class UnionFind:

    def __init__(self,n):

        super().__init__()

        self.par = [-1]*n

        self.rank = [0]*n

        self.tsize = [1]*n



    

    def root(self,x):

        if self.par[x] == -1:

            return x 

        else:

            self.par[x] = self.root(self.par[x])

            return self.par[x]



    def unite(self, x, y):

        x_r = self.root(x)

        y_r = self.root(y)

        

        if self.rank[x_r]>self.rank[y_r]:

            self.par[y_r] = x_r



        elif self.rank[x_r]<self.rank[y_r]:

            self.par[x_r] = y_r



        elif x_r != y_r:

            self.par[y_r] = x_r

            self.rank[x_r] += 1



        if x_r != y_r:

            size = self.tsize[x_r]+self.tsize[y_r]

            self.tsize[x_r] = size

            self.tsize[y_r] = size



    def isSame(self,x,y):

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



    def size(self,x):

        return self.tsize[self.root(x)]



def main():

    n,m = tuple([int(t)for t in input().split()])



    t = [tuple([int(t)-1 for t in input().split()])for _ in [0]*m]



    ans = 0

    for k in range(m):

        uf = UnionFind(n)

        for i in range(m):

            if k!=i:

                uf.unite(t[i][0],t[i][1])

        if uf.size(0) !=n :ans+=1

    

    print(ans)

if __name__ == "__main__":

    main()

from collections import deque

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



edge = []



for i in range(m):

  edge.append(tuple([int(a)-1 for a in input().split()]))

  

matrix = [[0]*n for _ in range(n)]

  

for a,b in edge:

  matrix[a][b] = 1

  matrix[b][a] = 1

  

ans = 0



for a,b in edge:

  matrix[a][b] = 0

  matrix[b][a] = 0

  

  checked = [False]*n

  queue = deque([0])

  while(len(queue)>0):

    q = queue.popleft()

    if checked[q]:

      continue

    else:

      checked[q] = True

      mat = matrix[q]

      for i in range(n):

        if mat[i] == 1:

          queue.append(i)

  if not all(checked):

    ans+=1

  

  matrix[a][b] = 1

  matrix[b][a] = 1



print(ans)
class UnionFind:
    def __init__(self, n):
        super().__init__()
        self.par = [-1] * n
        self.rank = [0] * n
        self.tsize = [1] * n

    def root(self, x):
        if self.par[x] == -1:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        if self.rank[x_r] > self.rank[y_r]:
            self.par[y_r] = x_r
        elif self.rank[x_r] < self.rank[y_r]:
            self.par[x_r] = y_r
        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1
        if x_r != y_r:
            size = self.tsize[x_r] + self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return self.tsize[self.root(x)]


def main():
    n, m = tuple([int(t) for t in input().split()])
    t = [tuple([int(t) - 1 for t in input().split()]) for _ in [0] * m]
    ans = 0
    for k in range(m):
        uf = UnionFind(n)
        for i in range(m):
            if k != i:
                uf.unite(t[i][0], t[i][1])
        if uf.size(0) != n:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

from collections import deque

n, m = tuple(map(int, input().split()))
edge = []
for i in range(m):
    edge.append(tuple([int(a) - 1 for a in input().split()]))
matrix = [[0] * n for _ in range(n)]
for a, b in edge:
    matrix[a][b] = 1
    matrix[b][a] = 1
ans = 0
for a, b in edge:
    matrix[a][b] = 0
    matrix[b][a] = 0
    checked = [False] * n
    queue = deque([0])
    while len(queue) > 0:
        q = queue.popleft()
        if checked[q]:
            continue
        else:
            checked[q] = True
            mat = matrix[q]
            for i in range(n):
                if mat[i] == 1:
                    queue.append(i)
    if not all(checked):
        ans += 1
    matrix[a][b] = 1
    matrix[b][a] = 1
print(ans)

-class UnionFind: -    def __init__(self, n): -        super().__init__() -        self.par = [-1] * n -        self.rank = [0] * n -        self.tsize = [1] * n +from collections import deque -    def root(self, x): -        if self.par[x] == -1: -            return x +n, m = tuple(map(int, input().split())) +edge = [] +for i in range(m): +    edge.append(tuple([int(a) - 1 for a in input().split()])) +matrix = [[0] * n for _ in range(n)] +for a, b in edge: +    matrix[a][b] = 1 +    matrix[b][a] = 1 +ans = 0 +for a, b in edge: +    matrix[a][b] = 0 +    matrix[b][a] = 0 +    checked = [False] * n +    queue = deque([0]) +    while len(queue) > 0: +        q = queue.popleft() +        if checked[q]: +            continue -            self.par[x] = self.root(self.par[x]) -            return self.par[x] - -    def unite(self, x, y): -        x_r = self.root(x) -        y_r = self.root(y) -        if self.rank[x_r] > self.rank[y_r]: -            self.par[y_r] = x_r -        elif self.rank[x_r] < self.rank[y_r]: -            self.par[x_r] = y_r -        elif x_r != y_r: -            self.par[y_r] = x_r -            self.rank[x_r] += 1 -        if x_r != y_r: -            size = self.tsize[x_r] + self.tsize[y_r] -            self.tsize[x_r] = size -            self.tsize[y_r] = size - -    def isSame(self, x, y): -        return self.root(x) == self.root(y) - -    def size(self, x): -        return self.tsize[self.root(x)] - - -def main(): -    n, m = tuple([int(t) for t in input().split()]) -    t = [tuple([int(t) - 1 for t in input().split()]) for _ in [0] * m] -    ans = 0 -    for k in range(m): -        uf = UnionFind(n) -        for i in range(m): -            if k != i: -                uf.unite(t[i][0], t[i][1]) -        if uf.size(0) != n: -            ans += 1 -    print(ans) - - -if __name__ == "__main__": -    main() +            checked[q] = True +            mat = matrix[q] +            for i in range(n): +                if mat[i] == 1: +                    queue.append(i) +    if not all(checked): +        ans += 1 +    matrix[a][b] = 1 +    matrix[b][a] = 1 +print(ans)