#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int h[N], ne[N], idx, e[N], cnt;
int dfn[N], low[N], isce[N];
int f[N][21];
int ecc[N];
int depth[N];
int fa[N];
vector<int> g[N];
long long ans;
long long d[N][2];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
int n, m, times;
void tarjan(int u) {
  dfn[u] = low[u] = ++times;
  int i;
  for (i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (!dfn[j]) {
      fa[j] = u;
      tarjan(j);
      low[u] = min(low[u], low[j]);
      if (dfn[u] < low[j]) isce[j] = 1;
    } else if (j != fa[u])
      low[u] = min(low[u], dfn[j]);
  }
}
void dfs(int u, int x) {
  ecc[u] = x;
  for (int i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (ecc[j] || fa[j] == u && isce[j] || fa[u] == j && isce[u]) continue;
    dfs(j, x);
  }
}
int dp(int u, int fa) {
  int i;
  for (i = 0; i < (int)g[u].size(); i++) {
    int j = g[u][i];
    if (j == fa) continue;
    int dis = dp(j, u) + 1;
    if (dis >= d[u][0]) {
      d[u][1] = d[u][0];
      d[u][0] = dis;
    } else if (dis > d[u][1]) {
      d[u][1] = dis;
    }
  }
  ans = max(ans, d[u][1] + d[u][0]);
  return d[u][0];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  int i;
  memset(h, -1, sizeof h);
  for (i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    add(a, b);
    add(b, a);
  }
  tarjan(1);
  for (i = 1; i <= n; i++) {
    if (!ecc[i]) {
      dfs(i, ++cnt);
    }
  }
  for (i = 1; i <= n; i++) {
    int j;
    for (j = h[i]; j != -1; j = ne[j]) {
      int k = e[j];
      if (ecc[i] == ecc[k]) continue;
      g[ecc[i]].push_back(ecc[k]);
    }
  }
  dp(1, -1);
  cout << ans << endl;
}
