#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int read() {
  int x = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * w;
}
int n, m, ano[maxn << 2];
struct edge {
  int u, v;
} E[maxn];
struct mmp {
  int to, id;
};
vector<mmp> g[maxn];
vector<int> g1[maxn];
int dfn[maxn], low[maxn], ins[maxn], dfn_num;
int belong[maxn], tot, maxx, cnt;
int f[maxn], ff[maxn];
stack<int> stk;
void dfs(int u, int pid) {
  dfn[u] = low[u] = ++dfn_num;
  stk.push(u);
  ins[u] = 1;
  int len = g[u].size();
  for (int i = 0; i < len; i++) {
    int v = g[u][i].to, id = g[u][i].id;
    if (ano[id] == pid) continue;
    if (!dfn[v])
      dfs(v, id), low[u] = min(low[u], low[v]);
    else if (ins[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (dfn[u] == low[u]) {
    tot++;
    while (1) {
      int v = stk.top();
      stk.pop();
      belong[v] = tot;
      ins[v] = 0;
      if (v == u) break;
    }
  }
}
void dp(int u, int fa) {
  int len = g1[u].size();
  for (int i = 0; i < len; i++) {
    int v = g1[u][i];
    if (v == fa) continue;
    dp(v, u);
    int now = f[v] + 1;
    if (now > f[u])
      ff[u] = f[u], f[u] = now;
    else if (now > ff[u])
      ff[u] = now;
  }
  maxx = max(maxx, f[u] + ff[u]);
}
void addedge(int u, int v) {
  g[u].push_back((mmp){v, ++cnt});
  ano[cnt] = cnt + 1;
  g[v].push_back((mmp){u, ++cnt});
  ano[cnt] = cnt - 1;
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    E[i] = (edge){u, v};
    addedge(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i, 0);
  for (int i = 1; i <= m; i++) {
    int u = E[i].u, v = E[i].v;
    if (belong[u] == belong[v]) continue;
    g1[belong[u]].push_back(belong[v]);
    g1[belong[v]].push_back(belong[u]);
  }
  dp(1, 0);
  cout << maxx << "\n";
}
