#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.14159265358979323846264338327950288419716939937510582097494459230;
const long long MOD = 1e9 + 7;
const long long INF = 1e17;
long long mpow(long long a, long long b) {
  a = a % MOD;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b = b >> 1;
  }
  return res % MOD;
}
vector<vector<long long> > a(300010);
bool vis[300010];
long long in[300010];
long long f[300010];
long long t;
long long n, m;
vector<pair<long long, long long> > ans;
long long wadqfewefeewfe[300010];
long long size[300010];
vector<vector<long long> > tree(300010);
long long temp;
long long get(long long node) {
  while (node != wadqfewefeewfe[node]) {
    node = wadqfewefeewfe[node];
  }
  return node;
}
void unite(long long node1, long long node2) {
  long long px = get(node1);
  long long py = get(node2);
  if (size[px] > size[py]) {
    swap(px, py);
  }
  wadqfewefeewfe[px] = py;
  size[py] += size[px];
}
void dfs(long long node, long long parent) {
  vis[node] = true;
  in[node] = f[node] = t++;
  for (auto c : a[node]) {
    if (c == parent)
      continue;
    else if (!vis[c]) {
      dfs(c, node);
      f[node] = min(f[node], f[c]);
      if (in[node] < f[c]) {
        ans.push_back({node, c});
      } else {
        unite(node, c);
      }
    } else {
      f[node] = min(f[node], in[c]);
    }
  }
}
void makebridge() {
  for (auto c : ans) {
    long long px = get(c.first);
    long long py = get(c.second);
    temp = py;
    tree[px].push_back(py);
    tree[py].push_back(px);
  }
}
long long maxcount = 0;
long long pos;
void dfs1(long long node, long long count) {
  vis[node] = true;
  count++;
  for (auto c : tree[node]) {
    if (vis[c]) continue;
    if (count > maxcount) {
      pos = c;
      maxcount = count;
    }
    dfs1(c, count);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (long long i = 0; i < 300010; i++) {
    f[i] = -1;
    in[i] = -1;
  }
  cin >> n >> m;
  for (int i = 0; i < (int)(m); ++i) {
    long long x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (long long i = 1; i <= n; i++) {
    size[i] = 1;
    wadqfewefeewfe[i] = i;
  }
  t = 0;
  dfs(1, -1);
  makebridge();
  for (long long i = 0; i < 300010; i++) {
    vis[i] = false;
  }
  dfs1(temp, 0);
  for (long long i = 0; i < 300010; i++) {
    vis[i] = false;
  }
  dfs1(pos, 0);
  cout << maxcount;
  return 0;
}
