#include <bits/stdc++.h>
using namespace std;
void qmax(long long &x, long long y) {
  if (x < y) x = y;
}
void qmin(long long &x, long long y) {
  if (x > y) x = y;
}
inline long long read() {
  char s;
  long long k = 0, base = 1;
  while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
    ;
  if (s == EOF) exit(0);
  if (s == '-') base = -1, s = getchar();
  while (isdigit(s)) {
    k = k * 10 + (s ^ '0');
    s = getchar();
  }
  return k * base;
}
inline void write(long long x) {
  static char cnt, num[15];
  cnt = 0;
  if (!x) {
    putchar('0');
    return;
  }
  for (; x; x /= 10) num[++cnt] = x % 10;
  for (; cnt; putchar(num[cnt--] + 48))
    ;
}
const long long maxn = 300110, maxm = 610010;
long long times, vis[maxn], low[maxn];
bool isb[maxm];
long long n, e, x[maxm], y[maxm];
long long tot, son[maxm], po[maxn], nxt[maxm];
void add(long long x, long long y) {
  son[++tot] = y;
  nxt[tot] = po[x];
  po[x] = tot;
}
void tarjan(long long x, long long fa) {
  low[x] = vis[x] = ++times;
  for (long long j = po[x]; j; j = nxt[j])
    if (!vis[son[j]]) {
      tarjan(son[j], x);
      low[x] = min(low[x], low[son[j]]);
      if (low[son[j]] > vis[x]) isb[j] = isb[j ^ 1] = 1;
    } else if (son[j] != fa)
      low[x] = min(low[x], vis[son[j]]);
    else
      fa = 0;
}
long long idb, bcc[maxn];
void bl(long long x) {
  bcc[x] = idb;
  for (long long j = po[x]; j; j = nxt[j])
    if (!isb[j] && !bcc[son[j]]) bl(son[j]);
}
long long a[maxm][2], last[maxn], kk, ma[maxn], ans;
void D(long long x, long long y) {
  a[++kk][0] = last[x];
  a[kk][1] = y;
  last[x] = kk;
}
void dfs(long long x, long long fa) {
  for (long long i = last[x]; i; i = a[i][0])
    if (a[i][1] != fa) {
      dfs(a[i][1], x);
      ans = max(ans, ma[a[i][1]] + ma[x] + 1);
      ma[x] = max(ma[a[i][1]] + 1, ma[x]);
    }
}
signed main() {
  n = read(), e = read();
  tot = 1;
  for (long long i = 1; i <= e; i++) {
    x[i] = read(), y[i] = read(), add(x[i], y[i]), add(y[i], x[i]);
  }
  for (long long i = 1; i <= n; i++)
    if (!vis[i]) tarjan(i, 0);
  for (long long i = 1; i <= n; i++)
    if (!bcc[i]) idb++, bl(i);
  for (long long i = 1; i <= e; i++)
    if (bcc[x[i]] != bcc[y[i]])
      D(bcc[x[i]], bcc[y[i]]), D(bcc[y[i]], bcc[x[i]]);
  dfs(1, 0);
  cout << ans << " ";
}
