#include <bits/stdc++.h>
using namespace std;
int n, m;
int head[300001], nxt[300001 << 1], ver[300001 << 1], id[300001 << 1], tot;
inline void addedge(int a, int b, int _id) {
  nxt[++tot] = head[a];
  ver[tot] = b;
  id[tot] = _id;
  head[a] = tot;
  nxt[++tot] = head[b];
  ver[tot] = a;
  id[tot] = _id;
  head[b] = tot;
}
int ans[300001];
int dfn[300001], low[300001], cnt;
int u[300001], v[300001];
inline void tarjan(int x, int lstedge) {
  dfn[x] = low[x] = ++cnt;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (!dfn[y]) {
      tarjan(y, i);
      low[x] = min(low[x], low[y]);
      if (low[y] > dfn[x]) ans[id[i]] = 1;
    } else if (i != (lstedge ^ 1))
      low[x] = min(low[x], dfn[y]);
  }
}
int fa[300001];
inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
int Head[300001], Nxt[300001 << 1], Ver[300001 << 1], Tot;
inline void Addedge(int a, int b) {
  Nxt[++Tot] = Head[a];
  Ver[Tot] = b;
  Head[a] = Tot;
  Nxt[++Tot] = Head[b];
  Ver[Tot] = a;
  Head[b] = Tot;
}
int start, startdis;
inline void dfs(int x, int nowdis, int fat) {
  if (nowdis > startdis) start = x, startdis = nowdis;
  for (int i = Head[x]; i; i = Nxt[i]) {
    int y = Ver[i];
    if (y == fat) continue;
    dfs(y, nowdis + 1, x);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  tot = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", u + i, v + i);
    addedge(u[i], v[i], i);
  }
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, -1);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++)
    if (!ans[i]) fa[find(u[i])] = find(v[i]);
  for (int i = 1; i <= m; i++)
    if (ans[i]) Addedge(find(u[i]), find(v[i]));
  startdis = 0;
  dfs(find(1), 0, 0);
  startdis = 0;
  dfs(start, 0, 0);
  cout << startdis;
  return 0;
}
