'use strict'

class Main {
  solve() {
    const size = input.nextIntArr();
    console.log(size);
    const nodes = input.nextIntRange(size[1]);
    const edges = [];
    for (const n of nodes) {
      edges[n[0]] = edges[n[0]] ? edges[n[0]] : [];
      edges[n[1]] = edges[n[1]] ? edges[n[1]] : [];
      edges[n[0]].push(n[1]);
      edges[n[1]].push(n[0]);
    }

    let cnt = 0;
    for (let i = 0; i < size[1]; ++i) {
      const n = nodes[i];
      const stack = [n[0]];
      const visited = [];
      while (stack.length > 0) {
        const e = stack.pop();
        visited[e] = true;
        for (let _e of edges[e]) {
          if (e == n[0] && _e == n[1]) { continue; }
          if (visited[_e]) {continue;}
          stack.push(_e);
        }
      }
      if (!visited[n[1]]) { ++cnt; }
    }
    console.log(cnt);
  }
}

class Input {
  constructor() {
    this.cursor = 0;
    this.inputAll();
  }

  inputAll() {
    this.data = (require("fs").readFileSync("/dev/stdin", "utf8")).split('\n');
    return this.data;
  }

  /* 1行 or 複数行文字列 */
  nextLine(n) {
    if (n) {
      const ret = this.data.slice(this.cursor, this.cursor + n);
      this.cursor += n;
      return ret;
    }
    return this.data[this.cursor++];
  }
  /* 一行文字配列 */
  nextStrArr() { return this.nextLine().split(' '); } 
  /* 一行整数配列 */
  nextIntArr() { return this.nextStrArr().map((e) => parseInt(e)); }
  /* 一行浮動小数点配列 */
  nextFloatArr() { return this.nextStrArr().map((e) => parseFloat(e)); }
  /* 複数行整数配列 */
  nextIntLine(n) { return this.nextLine(n).map((e) => parseInt(e)) }
  /* 複数行浮動小数点配列 */
  nextFloatLine(n) { return this.nextLine(n).map((e) => parseFloat(e)) }
  /* 複数行文字列二次元配列 */
  nextStrRange(n) { return this.nextLine(n).map((line) => line.split(' ')); }
  /* 複数行整数二次元配列 */
  nextIntRange(n) { return this.nextLine(n).map((line) => line.split(' ').map((e) => parseInt(e))); }
  /* 複数行浮動小数点数二次元配列 */
  nextFloatRange(n) {
    return this.nextLine(n).map((line) => line.split(' ').map((e) => parseFloat(e)));
  }
} 
const input = new Input();
(new Main()).solve();
