{$maxstacksize 10000000}
uses
  Math;
const
  maxn = 100000;
  maxm = 200000;
var
  deg, first : array[1..maxn] of integer;
  next, edge : array[1..2 * maxm] of integer;
  n, m, k, i, a, b, ans : integer;

procedure addedge(a, b : integer);
begin
  k := k + 1;
  deg[a] := deg[a] + 1;
  next[k] := first[a];
  first[a] := k;
  edge[k] := b;
end;

function dfs(i, par : integer) : integer;
var
  j : integer;
begin
  if (deg[i] > 2) then begin
    dfs := 0;
    exit;
  end;
  j := first[i];
  while (j <> 0) do begin
    if (edge[j] <> par) then begin
      dfs := dfs(edge[j], i) + 1;
      exit;
    end;
    j := next[j];
  end;
  dfs := 1;
end;

begin
  reset(input, 'graphtail.in');
  rewrite(output, 'graphtail.out');
  read(n, m);
  k := 0;
  for i := 1 to n do begin
    first[i] := 0;
    deg[i] := 0;
  end;
  for i := 1 to m do begin
    read(a, b);
    addedge(a, b);
    addedge(b, a);
  end;
  ans := 0;
  for i := 1 to n do begin
    if (deg[i] = 1) then begin
      ans := max(ans, dfs(i, 0));
    end;
  end;
  writeln(ans);
end.