#include <bits/stdc++.h>
const int mod = 1e9 + 7, MAX = 1e6 + 5;
const long long inf = 1e18 + 5;
const double pi = 3.14159265358979323846;
using namespace std;
long long fastexp(long long a, long long b) {
  long long ans = 1;
  long long temp = a;
  while (b > 0) {
    if (b & 1) ans = (ans * temp) % mod;
    temp = (temp * temp) % mod;
    b >>= 1;
  }
  return ans;
}
long long power(long long x, long long y) {
  long long temp = 1ll;
  while (y) {
    if (y & 1) temp = (temp * x);
    x = (x * x);
    y = y >> 1;
  }
  return temp;
}
void create(int si, int ei, int ind, int a[], int seg_tree[], bool flag) {
  if (si == ei - 1) {
    int ans = 0;
    if (flag)
      ans = a[si] | a[ei];
    else
      ans = a[si] ^ a[ei];
    seg_tree[ind] = ans;
    return;
  }
  int mid = si + (ei - si) / 2;
  create(si, mid, 2 * ind, a, seg_tree, !flag);
  create(mid + 1, ei, 2 * ind + 1, a, seg_tree, !flag);
  int ans;
  if (flag)
    ans = seg_tree[2 * ind] | seg_tree[2 * ind + 1];
  else
    ans = seg_tree[2 * ind] ^ seg_tree[2 * ind + 1];
  seg_tree[ind] = ans;
}
void update(int si, int ei, int ind, int a[], int seg_tree[], bool flag, int ti,
            int val) {
  if (si == ei - 1) {
    a[ti] = val;
    int ans;
    if (flag)
      ans = a[si] | a[ei];
    else
      ans = a[si] ^ a[ei];
    seg_tree[ind] = ans;
    return;
  }
  int mid = si + (ei - si) / 2;
  if (ti <= mid)
    update(si, mid, 2 * ind, a, seg_tree, !flag, ti, val);
  else
    update(mid + 1, ei, 2 * ind + 1, a, seg_tree, !flag, ti, val);
  int ans;
  if (flag)
    ans = seg_tree[2 * ind] | seg_tree[2 * ind + 1];
  else
    ans = seg_tree[2 * ind] ^ seg_tree[2 * ind + 1];
  seg_tree[ind] = ans;
}
map<int, vector<int>> edge;
int tim;
pair<int, int> dfs(int si, int p, vector<int>& disc, vector<int>& low) {
  ++tim;
  disc[si] = tim;
  low[si] = tim;
  int val = 0;
  int hval = 0;
  vector<int> hvec;
  for (auto g : edge[si]) {
    if (g == p) continue;
    if (disc[g] == 0) {
      auto pe = dfs(g, si, disc, low);
      int semi = pe.second;
      int ht = pe.first;
      if (disc[si] < low[g]) {
        ht++;
      }
      hvec.push_back(ht);
      val = max(semi, val);
      hval = max(ht, hval);
      low[si] = min(low[si], low[g]);
    } else {
      low[si] = min(low[si], disc[g]);
    }
  }
  if (hvec.size() == 0) return {0, 0};
  if (hvec.size() == 1) {
    return {hval, max(hval, val)};
  }
  sort(hvec.rbegin(), hvec.rend());
  hval = max(hvec[0], hvec[1]);
  val = max(val, hvec[0] + hvec[1]);
  return {hval, val};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while (1) {
    tim = 0;
    int n, m;
    cin >> n >> m;
    edge.clear();
    vector<int> low(n + 1);
    vector<int> disc(n + 1);
    for (int i = 0; i <= n; i++) {
      low[i] = 0;
      disc[i] = 0;
    }
    for (int i = 0; i < m; i++) {
      int x, y;
      cin >> x >> y;
      edge[x].push_back(y);
      edge[y].push_back(x);
    }
    int ans = dfs(1, 0, disc, low).second;
    cout << ans << "\n";
    break;
  }
  return 0;
}
