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 *;N,M,*A=list(map(int,open(0).read().split()));g=csr_matrix(([1]*M,(A[::2],A[1::2])),shape=(N+1,N+1)).tolil();c=0

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

 g[a,b]=0;n,_=csgraph.connected_components(g);c+=n!=2;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 *

N, M, *A = list(map(int, open(0).read().split()))
g = csr_matrix(([1] * M, (A[::2], A[1::2])), shape=(N + 1, N + 1)).tolil()
c = 0
for a, b in zip(*g.nonzero()):
    g[a, b] = 0
    n, _ = csgraph.connected_components(g)
    c += n != 2
    g[a, b] = 1
print(c)

-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 +N, M, *A = list(map(int, open(0).read().split())) +g = csr_matrix(([1] * M, (A[::2], A[1::2])), shape=(N + 1, N + 1)).tolil() -    c += connected_components(g, return_labels=False) != 1 +    n, _ = csgraph.connected_components(g) +    c += n != 2