#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e15;
const int N = 3e5 + 3;
int ans, t, discovery[N], lowest[N];
int dfs(vector<int> edges[], int sv, int parent) {
  discovery[sv] = lowest[sv] = t++;
  int largest = 0, secondLargest = 0;
  for (int child : edges[sv])
    if (discovery[child] == 0) {
      int childCount = dfs(edges, child, sv);
      if (lowest[child] > discovery[sv]) childCount++;
      lowest[sv] = min(lowest[sv], lowest[child]);
      if (childCount > largest) {
        secondLargest = largest;
        largest = childCount;
      } else if (childCount > secondLargest)
        secondLargest = childCount;
    } else if (child != parent)
      lowest[sv] = min(lowest[sv], discovery[child]);
  ans = max(ans, largest + secondLargest);
  return largest;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int u, v;
  vector<int> edges[n];
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--, v--;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  memset(discovery, 0, sizeof(discovery));
  t = 1;
  dfs(edges, 0, -1);
  cout << ans;
  return 0;
}
