#include <bits/stdc++.h>
using namespace std;
const int M = 300005;
int ttm = 1;
int n, m;
vector<int> G[M], G2[M];
int start[M], low[M];
bool vis[M], vis2[M];
int cc = 1;
int comp[M], dist[M];
int md, mdp;
void dfs2(int v, int p, int c) {
  comp[v] = c;
  for (int u : G[v])
    if (u != p && !comp[u]) dfs2(u, v, c);
}
void dfs(int v, int p = -1) {
  vis[v] = true;
  start[v] = ttm++;
  low[v] = start[v];
  for (int u : G[v]) {
    if (!vis[u]) {
      dfs(u, v);
      low[v] = min(low[v], low[u]);
      if (low[u] > start[v]) {
        dfs2(u, v, cc++);
      }
    } else if (u != p) {
      low[v] = min(low[v], start[u]);
    }
  }
}
void dfs3(int v) {
  if (vis2[v]) return;
  vis2[v] = true;
  for (int u : G[v]) {
    if (!vis2[u]) dfs3(u);
    if (comp[u] != comp[v]) G2[comp[u]].push_back(comp[v]);
  }
}
void dfs4(int v, int p = -1, int d = 0) {
  dist[v] = d;
  if (d > md) md = d, mdp = v;
  for (int u : G2[v]) {
    if (u != p) {
      dfs4(u, v, d + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    G[l].push_back(r), G[r].push_back(l);
  }
  dfs(1);
  dfs2(1, -1, cc++);
  dfs3(1);
  dfs4(1);
  md = 0;
  dfs4(mdp);
  cout << md << endl;
}
