using System;
using System.Collections.Generic;
using System.Linq;
#if !DEBUG
    using System.IO;
#endif

public class CanGo {
    HashSet<int>[] workGraph;
    int goal;

    public CanGo(HashSet<int>[] workGraph, int goal) {
        this.workGraph = workGraph;
        this.goal = goal;
    }

    public bool Connected(int v1, HashSet<int> History) {
        if (v1 == goal) {
            return true;
        }

        var nextNums = workGraph[v1].Where(v => !History.Contains(v)).ToList();
        if (nextNums.Count <= 0) {
            return false;
        }

        var nextHistory = new HashSet<int>(History);
        nextHistory.Add(v1);
        return nextNums.Select(v => Connected(v, nextHistory)).Any(b => b == true);
    }
}

public class Program {
    public static void Main() {
        #region SetAutoFlushIsFalse
#if !DEBUG
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
#endif
        #endregion
        var nm = ReadLib.ReadAsIntArray();
        var n = nm[0];
        var m = nm[1];

        var mArr = ReadLib.ReadNTimesAsIntArray(m, -1);

        var score = CalcScore(n, m, mArr);
        Console.WriteLine(score);
        #region Flush
#if !DEBUG
        Console.Out.Flush();
        sw.Close();
#endif
        #endregion
    }

    private static int CalcScore(int n, int m, int[][] mArr) {
        var cnt = 0;

        var graph = CreateGraph(n, mArr);
        foreach (var arr in mArr) {
            graph[arr[0]].Remove(arr[1]);
            graph[arr[1]].Remove(arr[0]);
            var cango = new CanGo(graph, arr[1]);
            if (cango.Connected(arr[0], new HashSet<int>())) {
                cnt++;
            }
            graph[arr[0]].Add(arr[1]);
            graph[arr[1]].Add(arr[0]);
        }
        return m-cnt;
    }


    private static HashSet<int>[] CreateGraph(int n, int[][] mArr) {
        var graph = new HashSet<int>[n];
        Enumerable.Range(0, n).ToList().ForEach(i => graph[i] = new HashSet<int>());
        foreach (var item in mArr) {
            graph[item[0]].Add(item[1]);
            graph[item[1]].Add(item[0]);
        }
        return graph;
    }
}

static class ReadLib {
    public static long ReadAsLong() {
        return long.Parse(Console.ReadLine());
    }

    public static int ReadAsInt() {
        return int.Parse(Console.ReadLine());
    }

    public static int[] ReadAsIntArray(int step = 0) {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s) + step).ToArray();
    }

    public static long[] ReadAsLongArray(int step = 0) {
        return Console.ReadLine().Split(' ').Select(s => long.Parse(s) + step).ToArray();
    }

    public static ulong[] ReadAsULongArray() {
        return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
    }

    public static string[] ReadAsStringArray() {
        return Console.ReadLine().Split(' ');
    }

    public static int[] ReadNTimesAsInt(int n, int step = 0) {
        return Enumerable.Range(1, n).Select(s => int.Parse(Console.ReadLine()) + step).ToArray();
    }

    public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
        return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
    }

}

static class MyMath {
    /// <summary>階乗</summary>
    public static long Factorial(int n) {
        if (n == 0) {
            return 1;
        }

        return Permutation(n, 0);
    }

    public static long Permutation(int n, int k) {
        return Enumerable.Range(0, n - k).Select(i => n - i).Aggregate(1, (b, i) => b * i);
    }

    /// <summary>nCr, 組み合わせ</summary>
    public static long Combination(int n, int r) {
        if (r == 0) {
            return 1;
        }
        // 分子
        var moleculeArr = Enumerable
            .Range(0, Math.Min(n - r, r))
            .Select(i => n - i)
            .ToArray();
        var moleculeArrLength = moleculeArr.Length;
        // 分母
        var denominatorArr = Enumerable
            .Range(1, Math.Max(n - r, r))
            .ToArray();

        for (var m = 0; m < moleculeArrLength; m++) {
            while (true) {
                var mVal = moleculeArr[m];
                var gcds = denominatorArr.Select(b => Gcd(mVal, b));
                var maxGcd = gcds.Max();
                var maxI = gcds.ToList().IndexOf(maxGcd);

                if (maxGcd == 1) {
                    break;
                }

                denominatorArr[maxI] /= maxGcd;
                moleculeArr[m] /= maxGcd;
            }
        }

        return FullPower(moleculeArr);
    }

    #region FullPower
    /// <summary>総乗、π</summary>
    public static long FullPower(IEnumerable<long> vs) {
        return vs.Aggregate(1L, (a, b) => a * b);
    }

    public static long FullPower(IEnumerable<int> vs) {
        return vs.Aggregate(1L, (a, b) => a * b);
    }
    #endregion

    /// <summary>最大公約数</summary>
    public static int Gcd(long item1, long item2) {
        var a = Math.Max(item1, item2);
        var b = Math.Min(item1, item2);

        while (true) {
            var mod = a % b;
            if (mod == 0) {
                break;
            }

            a = b;
            b = mod;
        }
        return (int)b;
    }

    /// <summary>約分。最大公約数で割ったものを返す。</summary>
    public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
        var gcd = Gcd(item1, item2);
        return new Tuple<long, long>(item1 / gcd, item2 / gcd);
    }
}

//static class IEnumerableExtention {
//    public static int IndexOfMax<T>(this IEnumerable<T> ts) {
//        var max = ts.Max();
//        return ts.ToList().IndexOf(max);
//    }

//    public static int IndexOfMax<T>(this IEnumerable<T> ts, Func<T, int> func) {
//        var funced = ts.Select(i => func(i));
//        var max = ts.Max(func);
//        return funced.ToList().IndexOf(max);
//    }

//    public static int IndexOfMax<T>(this IEnumerable<T> ts, Func<T, long> func) {
//        var funced = ts.Select(i => func(i));
//        var max = ts.Max(func);
//        return funced.ToList().IndexOf(max);
//    }
//}

Measured memory_bytes: 15924