#include <bits/stdc++.h>
using namespace std;
int low[300005], mx[300005], t[300005], tmp, ans;
vector<int> v[300005];
int n, m;
void dfs(int cur, int par = -1) {
  t[cur] = low[cur] = ++tmp;
  for (auto &x : v[cur]) {
    if (!t[x]) {
      dfs(x, cur);
      ans = max(ans, mx[cur] + mx[x] + (low[x] > t[cur]));
      mx[cur] = max(mx[cur], mx[x] + (low[x] > t[cur]));
      low[cur] = min(low[cur], low[x]);
    } else if (x != par)
      low[cur] = min(low[cur], t[x]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
