#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
vector<int> a[N];
int n, m, idn, ans = 0;
int low[N], id[N], dp[N], visit[N];
void DFS(int u, int p) {
  int Max = 0;
  visit[u] = 1;
  low[u] = id[u] = idn++;
  for (int v : a[u]) {
    if (v != p) {
      if (!visit[v]) {
        DFS(v, u);
        dp[u] = max(dp[u], dp[v] + (low[v] >= id[v]));
        ans = max(ans, Max + dp[v] + (low[v] >= id[v]));
        Max = max(Max, dp[v] + (low[v] >= id[v]));
      }
      low[u] = min(low[u], low[v]);
    }
  }
  ans = max(ans, dp[u]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  DFS(1, 0);
  cout << ans << endl;
  return 0;
}
