import static java.lang.Math.max;
import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.*;

public class graphtail_nn {

	static void solve() throws Exception {
		int n = nextInt();
		int m = nextInt();
		List<Integer>[] edges = new List[n];
		for (int i = 0; i < n; i++) {
			edges[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < m; i++) {
			int from = nextInt() - 1;
			int to = nextInt() - 1;
			edges[from].add(to);
			edges[to].add(from);
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (edges[i].size() > 1) {
				continue;
			}
			int last = i;
			int x = edges[i].get(0);
			int len = 1;
			while (edges[x].size() == 2) {
				len++;
				for (int j : edges[x]) {
					if (j != last) {
						last = x;
						x = j;
						break;
					}
				}
			}
			if (edges[x].size() == 1) {
				len++;
			}
			ans = max(ans, len);
		}
		out.println(ans);
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static void debug(Object... a) {
		System.err.println(deepToString(a));
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		try {
			File file = new File("graphtail.in");
			InputStream input = System.in;
			OutputStream output = System.out;
			if (file.canRead()) {
				input = (new FileInputStream(file));
				output = (new PrintStream("graphtail.out"));
			}
			br = new BufferedReader(new InputStreamReader(input));
			out = new PrintWriter(output);
			solve();
			out.close();
			br.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
