from scipy.sparse import lil_matrix

from scipy.sparse.csgraph import connected_components



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



g = lil_matrix((N, N))

for _ in range(M):

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

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



c = 0

for a, b in zip(*g.nonzero()):

  g[a, b] = 0

  c += connected_components(g, return_labels=False) != 1

  g[a, b] = 1

  

print(c)  
from scipy.sparse import *;from scipy.sparse.csgraph import connected_components;N,M=list(map(int,input().split()));g=lil_matrix((N,N))

for _ in [0]*M:

  a,b=list(map(int,input().split()));g[a-1,b-1]=1

c=0

for a,b in zip(*g.nonzero()):

  g[a,b]=0;c+=connected_components(g,return_labels=False)!=1;g[a,b]=1

print(c)
from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import connected_components

N, M = list(map(int, input().split()))
g = lil_matrix((N, N))
for _ in range(M):
    a, b = list(map(int, input().split()))
    g[a - 1, b - 1] = 1
c = 0
for a, b in zip(*g.nonzero()):
    g[a, b] = 0
    c += connected_components(g, return_labels=False) != 1
    g[a, b] = 1
print(c)

from scipy.sparse import *
from scipy.sparse.csgraph import connected_components

N, M = list(map(int, input().split()))
g = lil_matrix((N, N))
for _ in [0] * M:
    a, b = list(map(int, input().split()))
    g[a - 1, b - 1] = 1
c = 0
for a, b in zip(*g.nonzero()):
    g[a, b] = 0
    c += connected_components(g, return_labels=False) != 1
    g[a, b] = 1
print(c)

-from scipy.sparse import lil_matrix +from scipy.sparse import * -for _ in range(M): +for _ in [0] * M: