log = console.log;

var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin.split("\n");
var N = lines[0].split(" ").map(Number)[0];
var M = lines[0].split(" ").map(Number)[1];
var A = lines
  .slice(1)
  .filter(v => v !== "")
  .map(v => v.split(" ").map(Number));

var nLists = [];

for (var i = 0; i < M; i++) {
  nLists[i] = [];
  A.forEach((nm, A_i) => {
    if (A_i === i) return;
    var n = nm[0];
    var m = nm[1];
    if (nLists[i][m] === undefined) {
      nLists[i][m] = [n];
    } else {
      nLists[i][m].push(n);
    }
    if (nLists[i][n] === undefined) {
      nLists[i][n] = [m];
    } else {
      nLists[i][n].push(m);
    }
  });
}

function dfs(list, start, visited) {
  visited[start] = 1;
  list[start].forEach(point => {
    if (!visited[point]) dfs(list, point, visited);
  });
}

count = 0;
nLists.forEach(list => {
  var visited = [0];
  var firstPoint = list.findIndex(v=> v !== undefined)
  dfs(list, firstPoint, visited);
  if (visited.reduce((a,b)=>a+b) !== N) count += 1;
});

log(count);
