#include <bits/stdc++.h>
using namespace std;
const long long nax = 3e5 + 5;
long long n, m, ptr;
long long par[nax], low[nax], ins[nax], vis[nax];
pair<long long, long long> maxi;
vector<pair<long long, long long>> bridge;
vector<vector<long long>> v(nax), bridge_tree(nax);
long long f(long long idx) {
  if (idx == par[idx]) {
    return idx;
  } else {
    return par[idx] = f(par[idx]);
  }
}
void join(long long x, long long y) { par[f(x)] = f(y); }
void find_bridge(long long idx, long long bfr) {
  ptr++;
  vis[idx] = 1;
  low[idx] = ptr, ins[idx] = ptr;
  for (auto to : v[idx]) {
    if (to == bfr) continue;
    if (vis[to]) {
      low[idx] = min(low[idx], low[to]);
    } else {
      find_bridge(to, idx);
      low[idx] = min(low[idx], low[to]);
      if (low[to] > ins[idx]) {
        bridge.push_back({to, idx});
      } else {
        join(idx, to);
      }
    }
  }
}
void dfs(long long idx, long long bfr, long long val) {
  if (val > maxi.first) {
    maxi = {val, idx};
  }
  for (auto to : bridge_tree[idx]) {
    if (to != bfr) {
      dfs(to, idx, val + 1);
    }
  }
}
long long diameter(long long root) {
  maxi.first = -1;
  dfs(root, -1, 0);
  maxi.first = -1;
  dfs(maxi.second, -1, 0);
  return maxi.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    par[i] = i;
  }
  for (long long i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  find_bridge(1, -1);
  long long root = f(1);
  for (auto x : bridge) {
    long long lf = f(x.first), rg = f(x.second);
    bridge_tree[lf].push_back(rg);
    bridge_tree[rg].push_back(lf);
  }
  long long ans = diameter(root);
  cout << ans << '\n';
}
