#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long n, m, a[4951][4951], x, y, ans = 0, z, t, q, s2;
vector<long long> v;
int32_t main() {
  cin >> n;
  cin >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= n; j++) a[i][j] = 0;
  for (long long i = 0; i < m; i++) {
    cin >> x >> y;
    a[x][y] = 1;
    a[y][x] = 1;
  }
  while (q != -1) {
    s2 = ans;
    for (long long i = 1; i <= n; i++) {
      long long s1 = 0;
      for (long long j = 1; j <= n; j++)
        if (a[i][j] == 1) {
          s1++;
          z = i;
          t = j;
        }
      if (s1 == 1) {
        if (ans == s2) {
          ans++;
        }
        v.push_back(z);
        v.push_back(t);
      }
    }
    for (long long i = 0; i < v.size(); i = i + 2) {
      a[v[i]][v[i + 1]] = 0;
      a[v[i + 1]][v[i]] = 0;
    }
    if (ans == s2) {
      break;
    }
  }
  cout << ans;
  return 0;
}
