#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream& operator<<(ostream& os, const pair<first, second>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename first, typename second>
ostream& operator<<(ostream& os, const map<first, second>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello&... rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
const int mx = 3e5 + 5;
bool b[mx];
int n;
vector<vector<pair<int, int>>> adjlist;
vector<bool> visited;
vector<int> tin, low;
int timer;
void dfs_art(int u, int par = -1) {
  visited[u] = true;
  tin[u] = low[u] = timer++;
  for (auto to : adjlist[u]) {
    if (to.first == par) continue;
    if (visited[to.first]) {
      low[u] = min(low[u], tin[to.first]);
    } else {
      dfs_art(to.first, u);
      low[u] = min(low[u], low[to.first]);
      if (low[to.first] > tin[u]) {
        b[to.second] = 1;
      }
    }
  }
}
void find_bridges() {
  timer = 0;
  visited.clear();
  tin.clear();
  low.clear();
  visited.assign(n + 1, false);
  tin.assign(n + 1, -1);
  low.assign(n + 1, -1);
  for (int i = 1; i <= n; ++i) {
    if (!visited[i]) dfs_art(i);
  }
}
int m;
bool vis[mx];
vector<int> adjlist2[mx];
void dfs1(int u) {
  vis[u] = 1;
  queue<int> q;
  q.push(u);
  while (!q.empty()) {
    int U = q.front();
    q.pop();
    for (auto v : adjlist[U]) {
      if (!vis[v.first]) {
        vis[v.first] = 1;
        if (b[v.second]) {
          dfs1(v.first);
          adjlist2[u].push_back(v.first);
          adjlist2[v.first].push_back(u);
        } else
          q.push(v.first);
      }
    }
  }
}
int node, dis;
void dfs2(int u, int par, int dist) {
  if (dis < dist) {
    dis = dist;
    node = u;
  }
  for (auto v : adjlist2[u]) {
    if (v == par) continue;
    dfs2(v, u, dist + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  adjlist.resize(n + 1);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    adjlist[u].push_back(make_pair(v, i));
    adjlist[v].push_back(make_pair(u, i));
  }
  find_bridges();
  dfs1(1);
  dfs2(1, 0, 0);
  dis = 0;
  dfs2(node, 0, 0);
  cout << dis << '\n';
}
