#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
inline int read() {
  int x = 0, f = 1;
  char C = getchar();
  while (!isdigit(C)) {
    if (C == '-') f = -1;
    C = getchar();
  }
  while (isdigit(C)) x = (x << 1) + (x << 3) + C - '0', C = getchar();
  return x * f;
}
int n, m, cnt, head[maxn], to[maxn << 1], nxt[maxn << 1];
int dfn[maxn], tot, low[maxn], sta[maxn], top, col, co[maxn];
int H[maxn], T[maxn * 4], N[maxn * 4];
inline void add_edge(int x, int y) {
  to[++cnt] = x, nxt[cnt] = head[y], head[y] = cnt;
  to[++cnt] = y, nxt[cnt] = head[x], head[x] = cnt;
}
inline void Add_edge(int x, int y) {
  T[++cnt] = x, N[cnt] = H[y], H[y] = cnt;
  T[++cnt] = y, N[cnt] = H[x], H[x] = cnt;
}
inline void tarjan(int u, int fa) {
  dfn[u] = low[u] = ++tot;
  sta[++top] = u;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = to[i];
    if (v == fa) continue;
    if (!dfn[v]) {
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
    } else
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    col++;
    co[u] = col;
    while (sta[top] != u) {
      co[sta[top]] = col;
      top--;
    }
    top--;
  }
}
int f[maxn][2], Ans;
bool vis[maxn];
inline void DP(int u, int fa) {
  vis[u] = 1;
  int Max = 0;
  f[u][0] = f[u][1] = 1;
  for (int i = H[u]; i; i = N[i]) {
    int v = T[i];
    if (vis[v]) continue;
    DP(v, u);
    f[u][0] = max(f[u][0], f[v][0] + 1);
    f[u][1] = max(f[u][1], Max + f[v][0]);
    Max = max(Max, f[v][0] + 1);
  }
  Ans = max(Ans, max(f[u][1], f[u][0]));
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add_edge(x, y);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, 0);
  cnt = 0;
  for (int i = 1; i <= n; i++)
    for (int j = head[i]; j; j = nxt[j]) {
      int v = to[j];
      if (co[v] != co[i]) Add_edge(co[i], co[v]);
    }
  for (int i = 1; i <= col; i++)
    if (!vis[i]) DP(i, 0);
  printf("%d\n", Ans - 1);
  return 0;
}
