#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
bool bridge[MAXN + 5], vis[MAXN + 5];
int low[MAXN + 5], dep[MAXN + 5], cnt, group[MAXN + 5];
vector<pair<int, int>> G[MAXN + 5];
vector<int> Gc[MAXN + 5];
void find_bridge(int v, int pid, int d) {
  vis[v] = true;
  dep[v] = d;
  low[v] = d;
  for (pair<int, int> p : G[v]) {
    int first = p.first, second = p.second;
    if (second == pid) continue;
    if (vis[first]) {
      low[v] = min(low[v], dep[first]);
    } else {
      find_bridge(first, second, d + 1);
      low[v] = min(low[v], low[first]);
    }
  }
  if (low[v] == d) {
    bridge[pid] = true;
  }
}
void condense(int v) {
  vis[v] = true;
  group[v] = cnt;
  for (pair<int, int> p : G[v]) {
    if (vis[p.first] || bridge[p.second]) continue;
    condense(p.first);
  }
}
int hei[MAXN + 5], dia[MAXN + 5];
void dfs(int v, int p) {
  int h1 = 0, h2 = 0;
  for (int c : Gc[v]) {
    if (c == p) continue;
    dfs(c, v);
    int h = hei[c];
    dia[v] = max(dia[v], dia[c]);
    if (h > h1) {
      h2 = h1;
      h1 = h;
    } else if (h > h2) {
      h2 = h;
    }
  }
  hei[v] = h1 + 1;
  dia[v] = max(dia[v], h1 + h2 + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int V, E;
  cin >> V >> E;
  for (int i = 0; i < E; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(pair<int, int>(b, i + 1));
    G[b].push_back(pair<int, int>(a, i + 1));
  }
  find_bridge(1, 0, 1);
  fill(vis, vis + V + 1, false);
  for (int i = 1; i <= V; i++) {
    if (!vis[i]) {
      cnt++;
      condense(i);
    }
  }
  for (int i = 1; i <= V; i++) {
    for (pair<int, int> e : G[i]) {
      if (bridge[e.second]) {
        Gc[group[i]].push_back(group[e.first]);
      }
    }
  }
  dfs(1, 1);
  cout << dia[1] - 1 << "\n";
}
