#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > adj(n + 1);
  vector<int> indeg(n + 1, 0);
  vector<int> outdeg(n + 1, 0);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
    indeg[y]++;
    indeg[x]++;
    outdeg[x]++;
    outdeg[y]++;
  }
  int cnt = -1;
  int ram = 1;
  while (ram) {
    cnt++;
    queue<int> q;
    for (int i = 1; i <= n; i++) {
      if (indeg[i] + outdeg[i] == 2) q.push(i);
    }
    ram = q.size();
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      indeg[a]--;
      outdeg[a]--;
      for (auto it : adj[a]) {
        indeg[it]--;
        outdeg[it]--;
      }
    }
  }
  cout << cnt;
  return 0;
}
