#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long res = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    res = (res << 3) + (res << 1) + (ch ^ 48);
    ch = getchar();
  }
  return res * f;
}
struct Edge {
  long long v, next;
} edge[600005], edge2[600005];
long long head[300005], cnt;
long long head2[300005], cnt2;
long long dfn[300005], low[300005], tim, st[300005], top, co, col[300005],
    size[300005], vis[300005];
long long n, m;
long long maxdis, p;
inline void add(long long u, long long v) {
  cnt++;
  edge[cnt].next = head[u];
  edge[cnt].v = v;
  head[u] = cnt;
  return;
}
inline void add2(long long u, long long v) {
  cnt2++;
  edge2[cnt2].next = head2[u];
  edge2[cnt2].v = v;
  head2[u] = cnt2;
  return;
}
void dfs(long long u, long long fa, long long sum) {
  if (sum > maxdis) maxdis = sum, p = u;
  for (long long i = head2[u]; i; i = edge2[i].next) {
    long long v = edge2[i].v;
    if (v == fa) continue;
    dfs(v, u, sum + 1);
  }
}
void tarjan(long long u, long long fa) {
  dfn[u] = low[u] = ++tim;
  st[++top] = u;
  vis[u] = 1;
  for (long long i = head[u]; i; i = edge[i].next) {
    long long v = edge[i].v;
    if (v == fa) continue;
    if (!dfn[v]) {
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
    } else if (vis[v]) {
      low[u] = min(low[u], low[v]);
    }
  }
  if (dfn[u] == low[u]) {
    co++;
    while (st[top + 1] != u) {
      col[st[top]] = co;
      vis[st[top]] = false;
      top--;
    }
  }
}
signed main() {
  n = read(), m = read();
  for (long long i = 1; i <= m; i++) {
    long long u = read(), v = read();
    add(u, v);
    add(v, u);
  }
  tarjan(1, 0);
  for (long long i = 1; i <= n; i++) {
    for (long long j = head[i]; j; j = edge[j].next) {
      long long v = edge[j].v;
      if (col[v] != col[i]) add2(col[i], col[v]);
    }
  }
  dfs(1, 0, 0);
  maxdis = 0;
  dfs(p, 0, 0);
  printf("%lld\n", maxdis);
  return 0;
}
