#include <bits/stdc++.h>
using namespace std;
vector<int> adj[300007];
bool vis[300007];
int Time[300007], timeMin[300007], cnt = 0, res = 0;
int dfs(int u, int p) {
  vis[u] = true;
  Time[u] = timeMin[u] = cnt++;
  int ret = 0;
  vector<int> childList;
  for (auto child : adj[u]) {
    if (child == p) {
      continue;
    }
    if (vis[child]) {
      timeMin[u] = min(timeMin[u], Time[child]);
    } else {
      int temp = dfs(child, u);
      timeMin[u] = min(timeMin[u], timeMin[child]);
      if (timeMin[child] > Time[u]) {
        temp++;
      }
      ret = max(ret, temp);
      childList.push_back(temp);
    }
  }
  sort(childList.rbegin(), childList.rend());
  if (childList.size() == 1) {
    res = max(res, childList[0]);
  } else if (childList.size() > 1) {
    res = max(res, childList[0] + childList[1]);
  }
  return ret;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  dfs(0, -1);
  printf("%d\n", res);
}
