#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long inf = 100000000000000;
using namespace std;
template <class T>
void read_vector(vector<T> &__cur) {
  for (T &_c : __cur) {
    cin >> _c;
  }
}
template <class T>
void write_vector(vector<T> &__cur, string separator) {
  for (T &_c : __cur) {
    cout << _c << separator;
  }
}
unsigned long long fast_pow(unsigned long long a, unsigned long long n) {
  unsigned long long res = 1;
  while (n) {
    if (n & 1) {
      res *= a;
    }
    a *= a;
    n >>= 1;
  }
  return res;
}
vector<set<int>> g, cg;
vector<pair<long long, long long>> bridges;
vector<bool> used;
vector<int> fup, tin, number;
int timer = 0;
void dfs(int v, int p) {
  used[v] = true;
  tin[v] = timer++;
  fup[v] = tin[v];
  for (int u : g[v]) {
    if (u == p) {
      continue;
    }
    if (used[u]) {
      fup[v] = min(fup[v], tin[u]);
    } else {
      dfs(u, v);
      fup[v] = min(fup[v], fup[u]);
      if (fup[u] > tin[v]) bridges.push_back({v, u});
    }
  }
}
void dfs2(int v, int num) {
  used[v] = true;
  number[v] = num;
  for (int u : g[v]) {
    if (!used[u]) {
      dfs2(u, num);
    }
  }
}
void dfs3(int v, vector<int> &dist, int len) {
  used[v] = true;
  dist[v] = len;
  for (int u : cg[v]) {
    if (!used[u]) {
      dfs3(u, dist, len + 1);
    }
  }
}
void solve() {
  long long n, m;
  cin >> n >> m;
  g.resize(n);
  tin.resize(n, 0);
  fup.resize(n);
  number.resize(n);
  used.resize(n, false);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].insert(b);
    g[b].insert(a);
  }
  dfs(0, -1);
  for (auto br : bridges) {
    g[br.first].erase(br.second);
    g[br.second].erase(br.first);
  }
  used.clear();
  used.resize(n, false);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      dfs2(i, cnt);
      cnt++;
    }
  }
  cg.resize(cnt);
  for (auto br : bridges) {
    cg[number[br.first]].insert(number[br.second]);
    cg[number[br.second]].insert(number[br.first]);
  }
  used.clear();
  used.resize(cnt, false);
  vector<int> d(cnt, 0);
  dfs3(0, d, 0);
  int v = max_element(d.begin(), d.end()) - d.begin();
  d.clear();
  d.resize(cnt, 0);
  used.clear();
  used.resize(cnt, false);
  dfs3(v, d, 0);
  cout << *max_element(d.begin(), d.end());
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  srand(time(0));
  solve();
  return 0;
}
