#include <bits/stdc++.h>
using namespace std;
const long long MAX = 5e5;
map<pair<long long, long long>, long long> maps;
vector<long long> vec[MAX], tree[MAX];
pair<long long, long long> diam;
long long N, M, X, Y, timer, height[MAX], dp[MAX], mark[MAX];
void dfs(long long node, long long par, long long hei) {
  dp[node] = hei;
  height[node] = hei;
  for (auto A : vec[node]) {
    if (A == par)
      continue;
    else if (!height[A]) {
      dfs(A, node, hei + 1);
      dp[node] = min(dp[node], dp[A]);
      if (dp[A] >= height[A]) {
        maps[make_pair(A, node)]++;
        maps[make_pair(node, A)]++;
      }
    } else if (height[A] < height[node])
      dp[node] = min(dp[node], height[A]);
  }
  return;
}
void DfsMark(long long node) {
  for (auto A : vec[node]) {
    if (mark[A])
      continue;
    else if (maps[make_pair(node, A)] == 0) {
      mark[A] = mark[node];
      DfsMark(A);
    }
  }
  return;
}
void DfsTree(long long node, long long par, long long hei) {
  diam = max(diam, make_pair(hei, node));
  for (auto A : tree[node]) {
    if (A == par) continue;
    DfsTree(A, node, hei + 1);
  }
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> M;
  for (long long A = 1; A <= M; A++) {
    cin >> X >> Y;
    vec[X].push_back(Y);
    vec[Y].push_back(X);
  }
  dfs(1, 0, 1);
  for (long long A = 1; A <= N; A++) {
    if (!mark[A]) {
      mark[A] = A;
      DfsMark(A);
    }
  }
  for (long long A = 1; A <= N; A++)
    for (auto B : vec[A])
      if (mark[A] != mark[B]) tree[mark[A]].push_back(mark[B]);
  DfsTree(1, 0, 0);
  diam.first = 0;
  DfsTree(diam.second, 0, 0);
  cout << diam.first;
  return 0;
}
