#include <bits/stdc++.h>
using namespace std;
int n, m, x[300300], y[300300];
vector<int> graph[300300];
int counter, dfs_num[300300], dfs_low[300300], dfs_parent[300300];
vector<pair<int, int> > bs;
void bridges(int u) {
  dfs_low[u] = dfs_num[u] = counter++;
  for (int v : graph[u]) {
    if (!dfs_num[v]) {
      dfs_parent[v] = u;
      bridges(v);
      if (dfs_low[v] > dfs_num[u]) bs.push_back(pair<int, int>(u, v));
      dfs_low[u] = min(dfs_low[u], dfs_low[v]);
    } else if (v != dfs_parent[u]) {
      dfs_low[u] = min(dfs_low[u], dfs_num[v]);
    }
  }
}
vector<pair<int, int> > ng[300300];
struct subset {
  int parent, _rank;
} subsets[300300];
int Find(int i) {
  if (subsets[i].parent != i) subsets[i].parent = Find(subsets[i].parent);
  return subsets[i].parent;
}
void Union(int x, int y) {
  int xroot = Find(x), yroot = Find(y);
  if (subsets[xroot]._rank < subsets[yroot]._rank)
    subsets[xroot].parent = yroot;
  else if (subsets[xroot]._rank > subsets[yroot]._rank)
    subsets[yroot].parent = xroot;
  else {
    subsets[yroot].parent = xroot;
    subsets[xroot]._rank++;
  }
}
int maxi = 1, dist[300300];
void dfs(int u, int p, int d) {
  if (d > dist[maxi]) maxi = u;
  dist[u] = d;
  for (pair<int, int> v : ng[u]) {
    if (v.first != p) {
      dfs(v.first, u, d + v.second);
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x[i], &y[i]);
    graph[x[i]].push_back(y[i]);
    graph[y[i]].push_back(x[i]);
  }
  counter = 1;
  for (int i = 1; i <= n; i++)
    if (!dfs_num[i]) bridges(i);
  for (int i = 1; i <= n; i++) {
    subsets[i].parent = i;
    subsets[i]._rank = 1;
  }
  for (int i = 0; i < bs.size(); i++) {
    Union(bs[i].first, bs[i].second);
    ng[bs[i].first].push_back(pair<int, int>(bs[i].second, 1));
    ng[bs[i].second].push_back(pair<int, int>(bs[i].first, 1));
  }
  for (int i = 0; i < m; i++) {
    if (Find(x[i]) == Find(y[i])) continue;
    Union(x[i], y[i]);
    ng[x[i]].push_back(pair<int, int>(y[i], 0));
    ng[y[i]].push_back(pair<int, int>(x[i], 0));
  }
  dfs(1, 0, 0);
  memset(dist, 0, sizeof dist);
  dfs(maxi, 0, 0);
  printf("%d\n", dist[maxi]);
  return 0;
}
