#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <assert.h>

using namespace std;

vector< vector<int> > g;
vector<bool> used;

int dfs(int v)
{
    used[v] = true;
    int res = 1;
    for (int i = 0; i < g[v].size(); i++)
    {
        int u = g[v][i];
        if (!used[u] && g[u].size() == 2)
            res = dfs(u) + 1; 
    }
    return res;
};

int main()
{
    freopen("graphtail.in", "r", stdin);
    freopen("graphtail.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    assert(1 <= n && n <= 100000);
    assert(1 <= m && m <= 200000);
    g.resize(n + 1);
    used.resize(n + 1, false);
    for (int i = 0; i < m; i++)
    {
        int b, e;
        cin >> b >> e;
        assert(1 <= b && b <= n);
        assert(1 <= e && e <= n);
        g[b].push_back(e);
        g[e].push_back(b);   
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (!used[i] && g[i].size() == 1)
            ans = max(ans, dfs(i));
    }
    cout << ans;
}