#include <bits/stdc++.h>
using namespace std;
vector<long long int> graph[300005];
vector<long long int> graph2[300005];
map<pair<long long int, long long int>, bool> mp;
vector<pair<long long int, long long int> > edges;
long long int timer = 0;
bool visited1[300005];
bool visited2[300005];
long long int tin[300005];
long long int low[300005];
void dfs1(long long int v, long long int p) {
  visited1[v] = true;
  tin[v] = low[v] = timer++;
  pair<long long int, long long int> r;
  for (long long int i = 0; i < graph[v].size(); i++) {
    if (graph[v][i] == p) {
      continue;
    }
    if (visited1[graph[v][i]]) {
      low[v] = min(low[v], tin[graph[v][i]]);
    } else {
      dfs1(graph[v][i], v);
      low[v] = min(low[v], low[graph[v][i]]);
      if (low[graph[v][i]] > tin[v]) {
        r.first = min(v, graph[v][i]);
        r.second = max(v, graph[v][i]);
        mp[r] = 1;
      }
    }
  }
}
long long int mark = 0;
long long int col[300005];
void dfs2(long long int n) {
  visited2[n] = 1;
  col[n] = mark;
  for (long long int i = 0; i < graph[n].size(); i++) {
    if (visited2[graph[n][i]]) {
      continue;
    }
    pair<long long int, long long int> r;
    r.first = min(n, graph[n][i]);
    r.second = max(n, graph[n][i]);
    if (mp[r] != 1) {
      dfs2(graph[n][i]);
    }
  }
}
bool visited3[300005];
bool visited4[300005];
long long int cont[300005];
long long int ans = 0;
void dfs3(long long int n) {
  visited3[n] = 1;
  long long int maxi = 0;
  for (long long int i = 0; i < graph2[n].size(); i++) {
    if (visited3[graph2[n][i]]) {
      continue;
    }
    dfs3(graph2[n][i]);
    maxi = max(maxi, cont[graph2[n][i]] + 1);
  }
  cont[n] = maxi;
}
void dfs4(long long int n, long long int u) {
  visited4[n] = 1;
  ans = max(cont[n] + u, ans);
  pair<long long int, long long int> l;
  l.first = u;
  l.second = 0;
  for (long long int i = 0; i < graph2[n].size(); i++) {
    if (visited4[graph2[n][i]]) {
      continue;
    }
    if (l.first <= cont[graph2[n][i]] + 1) {
      l.second = l.first;
      l.first = cont[graph2[n][i]] + 1;
      continue;
    } else if (l.second <= cont[graph2[n][i]] + 1) {
      l.second = cont[graph2[n][i]] + 1;
      continue;
    }
  }
  for (long long int i = 0; i < graph2[n].size(); i++) {
    if (visited4[graph2[n][i]]) {
      continue;
    }
    if (l.first == cont[graph2[n][i]] + 1) {
      dfs4(graph2[n][i], l.second + 1);
    } else {
      dfs4(graph2[n][i], l.first + 1);
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  pair<long long int, long long int> r;
  for (long long int i = 1; i <= m; i++) {
    long long int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
    r.first = min(a, b);
    r.second = max(a, b);
    edges.push_back(r);
  }
  dfs1(1, 0);
  for (long long int i = 1; i <= n; i++) {
    if (visited2[i]) {
      continue;
    }
    mark++;
    dfs2(i);
  }
  for (long long int i = 0; i < edges.size(); i++) {
    if (col[edges[i].first] != col[edges[i].second]) {
      graph2[col[edges[i].first]].push_back(col[edges[i].second]);
      graph2[col[edges[i].second]].push_back(col[edges[i].first]);
    }
  }
  long long int leaf = 1;
  for (long long int i = 1; i <= mark; i++) {
    if (graph2[i].size() == 1) {
      leaf = i;
      break;
    }
  }
  dfs3(leaf);
  dfs4(leaf, 0);
  cout << ans;
}
