#include <bits/stdc++.h>
using namespace std;
int N, M, low[300010], disc[300010], visit[300010], idx = 0, treeIdx = 0;
vector<int> adj[300010], tree[300010];
void dfs(int node, int prev) {
  disc[node] = low[node] = idx++;
  for (int &nxt : adj[node]) {
    if (disc[nxt] == -1) {
      dfs(nxt, node);
      low[node] = min(low[node], low[nxt]);
    } else if (nxt != prev) {
      low[node] = min(low[node], low[nxt]);
    }
  }
}
void buildTree(int node, int treePar) {
  visit[node] = true;
  for (int &nxt : adj[node]) {
    if (!visit[nxt]) {
      if (low[nxt] > disc[node]) {
        treeIdx++;
        tree[treePar].push_back(treeIdx);
        buildTree(nxt, treeIdx);
      } else {
        buildTree(nxt, treePar);
      }
    }
  }
}
pair<int, int> dp(int node, int prev) {
  int maxsol = 0, maxlen = 0;
  vector<int> sz;
  for (int &nxt : tree[node]) {
    if (nxt == prev) continue;
    pair<int, int> val = dp(nxt, node);
    maxsol = max(maxsol, val.first);
    sz.push_back(val.second + 1);
    maxlen = max(maxlen, val.second + 1);
  }
  sort(sz.begin(), sz.end(), greater<int>());
  if (sz.size() >= 2) maxsol = max(maxsol, sz[0] + sz[1]);
  return {maxsol, maxlen};
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  memset(disc, -1, sizeof disc);
  dfs(1, -1);
  buildTree(1, 0);
  pair<int, int> val = dp(0, -1);
  cout << max(val.first, val.second) << '\n';
}
