#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const long long nax = 1e5 + 7;
const long long mod = 1e9 + 7;
const long long inf = numeric_limits<long long>::max();
long long n, m;
void test() {
  cin >> n >> m;
  vector<long long> deg(n + 1), adj[n + 1];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    deg[a]++, deg[b]++;
  }
  long long kicks = 0;
  set<pair<long long, long long>> spset;
  for (long long i = 1; i <= n; i++) {
    if (deg[i] == 0) {
      continue;
    }
    spset.insert({deg[i], i});
  }
  while (!spset.empty()) {
    vector<long long> top;
    while (!spset.empty() and spset.begin()->first == 1) {
      top.push_back(spset.begin()->second);
      spset.erase(spset.begin());
    }
    if (top.empty()) break;
    for (long long u : top) {
      for (long long v : adj[u]) {
        spset.erase({deg[v], v});
        if (--deg[v] == 0) continue;
        spset.insert({deg[v], v});
      }
    }
    kicks++;
  }
  cout << kicks;
}
signed main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  srand(time(NULL));
  long long T = 1;
  while (T--) {
    test();
    cout << "\n";
  }
  return 0;
}
