#include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
const long long N = 1000 * 1000 + 7;
long long test;
long long n, m;
vector<pair<long long, long long> > g[N];
long long cou, res;
long long czy[N], low[N];
void dfs(long long v, long long p) {
  czy[v] = low[v] = ++cou;
  for (auto &it : g[v]) {
    if (it.first != p) {
      if (czy[it.first] != 0) {
        low[v] = min(low[v], czy[it.first]);
      } else {
        dfs(it.first, v);
        low[v] = min(low[v], low[it.first]);
        if (low[it.first] == czy[it.first]) {
          it.second = 1;
        } else {
          it.second = 0;
        }
      }
    }
  }
}
long long dfs1(long long v, long long p) {
  czy[v] = 1;
  long long a = 0, b = 0;
  for (auto it : g[v]) {
    if (czy[it.first] == 0) {
      long long x = dfs1(it.first, v) + it.second;
      if (x > a) {
        b = a;
        a = x;
      } else if (x > b) {
        b = x;
      }
    }
  }
  res = max(res, a + b);
  return a;
}
void solve() {
  cin >> n >> m;
  for (long long i = 1; i <= (m); ++i) {
    long long a, b;
    cin >> a >> b;
    g[a].emplace_back(b, 1);
    g[b].emplace_back(a, 1);
  }
  dfs(1, 1);
  for (long long i = 1; i <= (n); ++i) {
    czy[i] = 0;
  }
  dfs1(1, 1);
  cout << res;
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  test = 1;
  for (long long i = 1; i <= test; i++) {
    solve();
  }
  return 0;
}
