#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 3e5 + 5;
vector<int> adj[maxn], v[maxn];
vector<pair<int, int> > edges;
vector<bool> visited;
vector<int> tin, fup;
int par[maxn], timer;
int n, m;
int root(int v) { return par[v] < 0 ? v : (par[v] = root(par[v])); }
int merge(int x, int y) {
  if ((x = root(x)) == (y = root(y))) return 0;
  if (par[y] < par[x]) swap(x, y);
  par[x] += par[y];
  par[y] = x;
  return 1;
}
void dfs(int v, int p = -1) {
  visited[v] = true;
  tin[v] = fup[v] = timer++;
  for (int to : adj[v]) {
    if (to == p) continue;
    if (visited[to]) {
      fup[v] = min(fup[v], tin[to]);
    } else {
      dfs(to, v);
      fup[v] = min(fup[v], fup[to]);
      if (fup[to] > tin[v]) {
        edges.emplace_back(v, to);
      } else
        merge(v, to);
    }
  }
}
void find_bridges() {
  timer = 0;
  visited.assign(n, false);
  tin.assign(n, -1);
  fup.assign(n, -1);
  for (int i = 0; i < n; ++i) {
    if (!visited[i]) dfs(i);
  }
}
void diameter_util(vector<int> tempGraph[], int &depth, int &starting_vertex,
                   int id, int p, int l) {
  if (depth < l) {
    depth = l;
    starting_vertex = id;
  }
  for (auto i : tempGraph[id]) {
    if (i != p) {
      diameter_util(tempGraph, depth, starting_vertex, i, id, l + 1);
    }
  }
}
int diameter(vector<int> tempGraph[], int starting_vertex) {
  int depth = 0;
  diameter_util(tempGraph, depth, starting_vertex, starting_vertex, -1, 0);
  depth = 0;
  diameter_util(tempGraph, depth, starting_vertex, starting_vertex, -1, 0);
  return depth;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    adj[x - 1].push_back(y - 1);
    adj[y - 1].push_back(x - 1);
  }
  for (int i = 0; i < maxn; ++i) {
    par[i] = -1;
  }
  find_bridges();
  if (edges.empty()) {
    cout << 0 << '\n';
    ;
    return 0;
  }
  vector<int> tempGraph[n + 1];
  for (auto it : edges) {
    int x = root(it.first);
    int y = root(it.second);
    tempGraph[x].emplace_back(y);
    tempGraph[y].emplace_back(x);
  }
  cout << diameter(tempGraph, root(edges.back().first)) << '\n';
  ;
  return 0;
}
