#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
void solve() {
  long long int i, j, m, n, a, b, c = -1;
  cin >> n >> m;
  set<long long int> v[n + 1];
  vector<long long int> group;
  map<long long int, long long int> kicked;
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    v[a].insert(b);
    v[b].insert(a);
  }
  do {
    group.clear();
    for (i = 1; i <= n; i++) {
      if (kicked[i]) continue;
      if (v[i].size() == 1) {
        group.push_back(i);
        kicked[i] = 1;
      }
    }
    for (auto it1 : group) {
      for (auto it2 : v[it1]) {
        v[it2].erase(it1);
      }
    }
    c++;
  } while (group.size());
  cout << c << endl;
}
