#include <bits/stdc++.h>
using namespace std;
const int N = 330000;
vector<int> con[N];
int dp[N], vis[N], idn, low[N], id[N], ans;
void dfs(int u, int p) {
  vis[u] = 1;
  low[u] = id[u] = ++idn;
  int Max = 0;
  for (int v : con[u])
    if (v != p) {
      if (!vis[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);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    con[u].push_back(v), con[v].push_back(u);
  }
  dfs(1, 0);
  cout << ans << endl;
  return 0;
}
