#include <bits/stdc++.h>
using namespace std;
vector<bool> prime(1000005 + 1, true);
void sieve() {
  long long i, j, k;
  prime[0] = prime[1] = false;
  for (i = 2; i * i <= 1000005; i++) {
    if (prime[i]) {
      for (j = i * i; j <= 1000005; j += i) {
        prime[j] = false;
      }
    }
  }
}
long long power(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b % 2 == 1) r = r * a;
    b /= 2;
    a *= a;
  }
  return r;
}
long long power(long long a, long long b, long long m) {
  a = a % m;
  long long r = 1;
  while (b) {
    if (b % 2 == 1) r = (r * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return r;
}
vector<long long> factors(long long n) {
  vector<long long> r;
  long long i, j;
  for (i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      r.push_back(i);
      if (n / i != i) r.push_back(n / i);
    }
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b > a) {
    long long t = a;
    a = b;
    b = t;
  }
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
vector<bool> bvisited(1000005, false);
vector<long long> bfs(long long V, vector<vector<long long>> G, long long s) {
  vector<long long> order;
  queue<long long> q;
  bvisited[s] = true;
  q.push(s);
  while (!q.empty()) {
    s = q.front();
    order.push_back(s);
    for (auto x : G[s]) {
      if (!bvisited[x]) {
        bvisited[x] = true;
        q.push(x);
      }
    }
  }
  return order;
}
vector<bool> dvisited(1000005, false), chk(1000005, false);
vector<set<long long>> G(1000005);
vector<long long> dfs(long long s, long long n) {
  vector<long long> order;
  stack<long long> q;
  q.push(s);
  while (!q.empty()) {
    long long v = q.top();
    q.pop();
    if (!dvisited[v] && !chk[v]) {
      dvisited[v] = true;
      if (G[v].size() == 1) {
        chk[v] = true;
        order.push_back(v);
      }
      for (auto x : G[v]) {
        if (!dvisited[x] && !chk[x]) {
          q.push(x);
        }
      }
    }
  }
  for (auto x : order) {
    G[x].clear();
    for (long long i = 1; i <= n; i++) {
      G[i].erase(x);
    }
  }
  return order;
}
void solve() {
  long long n, m, i, j, k, u = 0;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> j >> k;
    G[j].insert(k);
    G[k].insert(j);
  }
  bool f = true;
  k = 0;
  while (f) {
    for (i = 1; i <= n; i++) dvisited[i] = false;
    for (i = 1; i <= n; i++) {
      if (!dvisited[i] && !chk[i]) dfs(i, n);
    }
    j = 0;
    for (i = 1; i <= n; i++) {
      j += chk[i] ? 1 : 0;
    }
    if (j <= k)
      f = false;
    else
      u++;
    k = j;
  }
  k = 0;
  for (i = 1; i <= n; i++) k += chk[i] ? 0 : 1;
  cout << u;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
