#include <fstream>
#include <vector>

using namespace std;

const char iname[] = "dag.in";
const char oname[] = "dag.out";

ifstream f(iname);
ofstream g(oname);

int main() {
	int N, M;
	f >> N >> M;

	vector< vector<int> > E(N);
	vector<int> grade(N, 0);

	for (int i = 0; i < M; ++i) {
		int x, y;
		f >> x >> y;

		--x; --y;
		E[x].push_back(y);
		E[y].push_back(x);

		++grade[x]; ++grade[y];
	}

	vector< vector<int> > list(N);
	for (int i = 0; i < N; ++i)
		list[grade[i]].push_back(i);
	
	int answer = 0;
	vector<int> stack;

	for (int i = 1; i < N; ++i) {
		for (size_t j = 0; j < list[i].size(); ++j)
			if (grade[list[i][j]] == i)
				stack.push_back(list[i][j]);

		while (stack.size() > 0) {
			int x = stack.back();
			answer = max(answer, grade[x]);
			stack.pop_back();
			for (vector<int>::iterator it = E[x].begin(); it != E[x].end(); ++it) {
				if (--grade[*it] == i)
					stack.push_back(*it);
				list[grade[*it]].push_back(*it);
			}
		}
	}

	g << answer << "\n";
}
	
