#include <bits/stdc++.h>
using namespace std;
inline long long GCD(long long a, long long b) {
  while (b != 0) {
    int t = a;
    a = b;
    b = t % b;
  }
  return a;
}
inline long long LCM(long long a, long long b) {
  if (a == 0 || b == 0) return GCD(a, b);
  return a * b / GCD(a, b);
}
inline long long CEIL(long long n, long long d) { return n / d + n % d != 0; }
inline long long ROUND(long long n, long long d) {
  return n / d + (long long)((n % d) * 2 >= d);
}
inline long long POW(long long a, long long n) {
  if (n < 0) return 0;
  long long ret = 1;
  while (n) {
    if (n % 2) ret *= a;
    a = a * a;
    n /= 2;
  }
  return ret;
}
const int MAXN = 3e5, INF = 0x7fffffff;
int n, m, ncnt, ans, vid[MAXN], par[MAXN], dp[MAXN];
vector<pair<int, int> > g[MAXN];
void input() {
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back({0, v});
    g[v].push_back({0, u});
  }
}
int dfs(int u) {
  int ret = vid[u] = ncnt++;
  for (auto& e : g[u]) {
    int v = e.second, c = INF;
    if (par[u] == v) continue;
    if (vid[v] == -1) {
      par[v] = u;
      c = min(c, dfs(v));
    } else if (vid[v] > vid[u])
      c = min(c, vid[u]);
    else
      c = min(c, vid[v]);
    if (c > vid[u]) e.first = 1;
    ret = min(ret, c);
  }
  return ret;
}
void f(int u) {
  int fir = 0, sec = 0;
  for (auto& e : g[u]) {
    int v = e.second, c = e.first;
    if (par[v] != u) continue;
    f(v);
    dp[u] = max(dp[u], dp[v] + c);
    sec = max(sec, dp[v] + c);
    if (fir < sec) swap(fir, sec);
  }
  ans = max(ans, fir + sec);
}
int solve() {
  memset(vid, -1, sizeof(vid));
  dfs(0);
  f(0);
  cout << ans << '\n';
  return 0;
}
void execute() { input(), solve(); }
int main(void) {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  execute();
  return 0;
}
