#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
long long mod = 1000000007;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
bool is_vowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return 1;
  return 0;
}
double getDistance(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
long long extended_euclidean(long long a, long long b, long long &x,
                             long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long g = extended_euclidean(b, a % b, y, x);
  y -= (a / b) * x;
  return g;
}
long long power(long long base, long long p) {
  if (p == 1) return base;
  if (!p) return 1ll;
  long long ret = power(base, p / 2);
  ret *= ret;
  ret %= mod;
  if (p & 1) ret *= base;
  return ret % mod;
}
pair<long long, long long> vec(pair<long long, long long> a,
                               pair<long long, long long> b) {
  pair<long long, long long> ret =
      pair<long long, long long>(a.first - b.first, a.second - b.second);
  return ret;
}
long long getArea(pair<long long, long long> a, pair<long long, long long> b,
                  pair<long long, long long> c) {
  pair<long long, long long> x = vec(a, b);
  pair<long long, long long> y = vec(c, b);
  return abs(x.first * y.second - x.second * y.first);
}
bool intersect(const complex<double> &a, const complex<double> &b,
               const complex<double> &p, const complex<double> &q,
               complex<double> &ret) {
  double d1 = ((conj(p - a) * (b - a)).imag());
  double d2 = ((conj(q - a) * (b - a)).imag());
  ret = (d1 * q - d2 * p) / (d1 - d2);
  return fabs(d1 - d2) > 1e-9;
}
double getDistance(complex<double> a, complex<double> b) {
  return sqrt((a.real() - b.real()) * (a.real() - b.real()) +
              (a.imag() - b.imag()) * (a.imag() - b.imag()));
}
vector<int> AdjList[N];
int n, dfs_low[N], dfs_num[N], dfsNumberCounter = 1, dfs_parent[N];
int dsu[N], rnk[N];
int get(int a) { return (dsu[a] == a) ? a : get(dsu[a]); }
void merge(int a, int b) {
  a = get(a);
  b = get(b);
  if (a == b) return;
  if (rnk[a] < rnk[b]) swap(a, b);
  dsu[b] = a;
  rnk[a] += rnk[b];
}
map<pair<long long, long long>, bool> b;
void articulationPointAndBridge(int u) {
  dfs_low[u] = dfs_num[u] = dfsNumberCounter++;
  for (int j = 0; j < (int)AdjList[u].size(); j++) {
    int v = AdjList[u][j];
    if (dfs_num[v] == 0) {
      dfs_parent[v] = u;
      articulationPointAndBridge(v);
      if (dfs_low[v] > dfs_num[u]) {
        b[pair<long long, long long>(v, u)] =
            b[pair<long long, long long>(u, v)] = 1;
      }
      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]);
  }
}
int sol = 0;
vector<int> adj[N];
pair<long long, long long> dfs(int node, int p) {
  int mx1 = 0, mx2 = 0;
  for (int i = (0); i <= ((int)adj[node].size() - 1); ++i) {
    if (adj[node][i] != p) {
      pair<long long, long long> a = dfs(adj[node][i], node);
      if (a.first + 1 > mx1) {
        swap(mx1, mx2);
        mx1 = a.first + 1;
      } else if (a.first + 1 > mx2) {
        mx2 = a.first + 1;
      }
    }
  }
  sol = max(sol, mx1 + mx2);
  return pair<long long, long long>(mx1, mx2);
}
int main() {
  int m;
  cin >> n >> m;
  vector<pair<long long, long long> > t;
  for (int i = (1); i <= (n); ++i) {
    rnk[i] = 1;
    dsu[i] = i;
  }
  for (int i = (1); i <= (m); ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    AdjList[a].push_back(b);
    AdjList[b].push_back(a);
    t.push_back(pair<long long, long long>(a, b));
  }
  articulationPointAndBridge(1);
  for (int i = (0); i <= (m - 1); ++i) {
    if (b[t[i]]) continue;
    merge(t[i].first, t[i].second);
  }
  for (int i = (0); i <= (m - 1); ++i) {
    if (!b[t[i]]) continue;
    int a = get(t[i].first);
    int b = get(t[i].second);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(get(1), 0);
  cout << sol;
  return 0;
}
