#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (auto x : v) os << x << ' ';
  os << '\n';
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << '(' << p.first << ',' << p.second << ')';
  os << '\n';
  return os;
}
const char *fin = "";
const char *fon = "";
const int OO = (int)(1e9 + 7);
const int MAXN = (int)(3e5 + 5);
int n, m;
vector<pair<int, int> > a[MAXN];
int low[MAXN], num[MAXN], isBridge[MAXN];
int cnt, bridge;
void Dfs(int u, int p) {
  num[u] = low[u] = ++cnt;
  for (pair<int, int> x : a[u]) {
    int v = x.first;
    int id = x.second;
    if (v != p) {
      if (num[v] == 0) {
        Dfs(v, u);
        low[u] = min(low[u], low[v]);
        if (low[v] >= num[v]) {
          ++bridge;
          isBridge[id] = 1;
        }
      } else
        low[u] = min(low[u], num[v]);
    }
  }
}
int d[MAXN];
void Dfs1(int u) {
  num[u] = 1;
  for (pair<int, int> x : a[u]) {
    int v = x.first;
    int id = x.second;
    if (num[v] == 0) {
      d[v] = d[u] + isBridge[id];
      Dfs1(v);
    }
  }
}
void Sol() {
  cnt = 0;
  for (int i = 1; i <= n; ++i)
    if (num[i] == 0) Dfs(i, i);
  memset(num, 0, sizeof(num));
  Dfs1(1);
  int start = max_element(d + 1, d + n + 1) - d;
  memset(num, 0, sizeof(num));
  memset(d, 0, sizeof(d));
  Dfs1(start);
  cout << *max_element(d + 1, d + n + 1);
}
void Inp() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    a[u].push_back({v, i});
    a[v].push_back({u, i});
  }
  Sol();
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  Inp();
  return 0;
}
