import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto edges = new int[][](N);
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        edges[s[0]-1] ~= s[1]-1;
        edges[s[1]-1] ~= s[0]-1;
    }

    auto used = new bool[](N);
    void dfs(int n) {
        if (used[n]) return;
        used[n] = true;
        foreach (m; edges[n]) {
            if (!used[m]) dfs(m);
        }
    }

    int ans = 0;
    foreach (i; 0..N) {
        used.fill(false);
        int x = i == 0 ? 1 : 0;
        used[i] = true;
        dfs(x);
        if (used.sum != N) ans += 1;
    }

    ans.writeln;
}
