#include <bits/stdc++.h>
using namespace std;
const int mxn = 300005;
const int inf = 1e8;
int n, m;
vector<int> G[mxn];
int dist[mxn];
int clk, prnt[mxn], dfs_low[mxn], dfs_num[mxn];
map<pair<int, int>, int> bridges;
void articulation_bridge(int u) {
  dfs_num[u] = dfs_low[u] = ++clk;
  for (auto& v : G[u]) {
    if (!dfs_num[v]) {
      prnt[v] = u;
      articulation_bridge(v);
      if (dfs_low[v] > dfs_num[u]) {
        bridges[{min(u, v), max(u, v)}]++;
      }
      dfs_low[u] = min(dfs_low[u], dfs_low[v]);
    } else if (v != prnt[u])
      dfs_low[u] = min(dfs_low[u], dfs_num[v]);
  }
}
void bfs01(int st) {
  for (int i = 0; i <= n; dist[i] = inf, i++)
    ;
  deque<int> Q;
  Q.push_back(st);
  dist[st] = 0;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop_front();
    for (auto& v : G[u]) {
      pair<int, int> edge = {min(u, v), max(u, v)};
      int cost = (bridges.find(edge) != bridges.end());
      if (dist[v] <= dist[u] + cost) continue;
      dist[v] = dist[u] + cost;
      if (cost)
        Q.push_back(v);
      else
        Q.push_front(v);
    }
  }
}
int solution() {
  articulation_bridge(1);
  bfs01(1);
  int nd = 1, mxdist = 0;
  for (int u = 1; u <= n; u++) {
    if (dist[u] < mxdist) continue;
    mxdist = dist[u];
    nd = u;
  }
  bfs01(nd);
  int res = 0;
  for (int u = 1; u <= n; res = max(res, dist[u]), u++)
    ;
  return res;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  int res = solution();
  printf("%d\n", res);
  return 0;
}
