#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
const int MAXN = 300005;
struct Edge {
  int from, to, next;
} edge[MAXN * 10];
int head[MAXN], num_edge;
void add_edge(int from, int to) {
  edge[++num_edge].to = to;
  edge[num_edge].next = head[from];
  edge[num_edge].from = from;
  head[from] = num_edge;
}
int pre[MAXN], bccno[MAXN], dfs_clock, bcc_cnt;
stack<int> s;
int dfs(int x, int fa) {
  s.push(x);
  int lowu = pre[x] = ++dfs_clock;
  for (int i = head[x]; i; i = edge[i].next) {
    Edge e = edge[i];
    if (!pre[e.to]) {
      int lowv = dfs(e.to, x);
      lowu = min(lowu, lowv);
      if (lowv > pre[x]) {
        bcc_cnt++;
        while (1) {
          if (s.top() == e.to) break;
          bccno[s.top()] = bcc_cnt;
          s.pop();
        }
        bccno[s.top()] = bcc_cnt;
        s.pop();
      }
    } else if (pre[e.to] < pre[x] && e.to != fa) {
      lowu = min(lowu, pre[e.to]);
    }
  }
  return lowu;
}
void find_bcc(int n) {
  for (int i = 1; i <= n; i++)
    if (!pre[i]) dfs(i, -1);
}
vector<int> G[MAXN];
void add(int from, int to) { G[from].push_back(to); }
void build() {
  for (int i = 1; i <= num_edge; i++) {
    Edge e = edge[i];
    if (bccno[e.to] != bccno[e.from]) add(bccno[e.to], bccno[e.from]);
  }
}
int ans;
int dp(int x, int fa) {
  if (G[x].size() == 1 && G[x][0] == fa) return 0;
  int Max1 = 0, Max2 = 0;
  for (int i = 0, k = G[x].size(); i < k; i++) {
    int v = G[x][i];
    if (v == fa) continue;
    int tmp = dp(v, x) + 1;
    if (tmp > Max1) {
      Max2 = Max1;
      Max1 = tmp;
    } else if (tmp > Max2)
      Max2 = tmp;
  }
  ans = max(Max1 + Max2, ans);
  return Max1;
}
void debug(int n = 20) {
  printf("\n-------------------------------\n");
  for (int i = 0; i <= n; i++) {
    printf("%d ", bccno[i]);
  }
  printf("\n-------------------------------\n");
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add_edge(u, v);
    add_edge(v, u);
  }
  find_bcc(n);
  build();
  dp(1, -1);
  printf("%d\n", ans);
  return 0;
}
