#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long MAXN = 300002;
long long n, m, ccid[MAXN], cnt;
vector<long long> edge[MAXN], cc[MAXN], stk;
long long dfn[MAXN], t, low[MAXN];
void dfs1(long long nd, long long par) {
  low[nd] = dfn[nd] = ++t;
  stk.emplace_back(nd);
  for (auto v : edge[nd]) {
    if (dfn[v] == 0) {
      dfs1(v, nd);
    }
    if (v != par) {
      low[nd] = min(low[nd], low[v]);
    }
  };
  if (low[nd] > dfn[par] || nd == par) {
    while (stk.size()) {
      cc[cnt].emplace_back(stk.back());
      ccid[stk.back()] = cnt;
      stk.pop_back();
      if (cc[cnt].back() == nd) {
        break;
      }
    }
    cnt++;
  }
}
vector<long long> g[MAXN];
pair<long long, long long> dfs2(long long nd, long long par) {
  pair<long long, long long> ret = {nd, 0};
  for (auto v : g[nd]) {
    if (v != par) {
      pair<long long, long long> cur = dfs2(v, nd);
      if (cur.second + 1 > ret.second) {
        ret = cur;
        ret.second++;
      }
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < m; i += 1) {
    long long u, v;
    cin >> u >> v;
    edge[u].emplace_back(v);
    edge[v].emplace_back(u);
  }
  dfs1(1, 1);
  ;
  for (long long i = 0; i < n; i += 1) {
    for (auto v : cc[i]) {
      for (auto v2 : edge[v]) {
        if (ccid[v2] != i) {
          g[i].emplace_back(ccid[v2]);
        }
      }
    }
  }
  long long rt = dfs2(1, 1).first;
  ;
  cout << dfs2(rt, rt).second << '\n';
  return 0;
}
