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

public class graphtail_pk {
	public static void main(String[] args) {
		new graphtail_pk().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	ArrayList<Integer>[] e;
	boolean[] w;
	int cnt;
	
	
	public void dfs(int t) {
		if (w[t])
			return;
		w[t] = true;
		cnt++;
		for (int i = 0; i < e[t].size(); i++) {
			dfs(e[t].get(i));
		}
	}
	
	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		assert ((1 <= n) && (n <= 100000));
		assert ((1 <= m) && (m <= 200000));
		e = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			e[i] = new ArrayList<Integer>();
		}
		HashSet<Long> was = new HashSet<Long>();
		for (int i = 0; i < m; i++) {
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			e[a].add(b);
			e[b].add(a);
			long hash = a * (long)1e9 + b;
			assert(!was.contains(hash));
			was.add(hash);
			was.add(b * (long)1e9 + a);
			assert ((0 <= a) && (a < n));
			assert ((0 <= b) && (b < n));
			assert (a != b);
		}
		int ans = 0;
		w = new boolean[n];
		cnt = 0;
		dfs(0);
		assert(cnt == n);
		for (int i = 0; i < n; i++) {
			if (e[i].size() > 1)
				continue;
			int p = i;
			int t = e[i].get(0);
			int k = 1;
			while (e[t].size() == 2) {
				int ot = t;
				if (e[t].get(0) != p)
					t = e[t].get(0);
				else
					t = e[t].get(1);
				p = ot;
				k++;
			}
			if (e[t].size() == 1)
				k++;
			if (k > ans)
				ans = k;
		}
		out.println(ans);
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			br = new BufferedReader(new FileReader("graphtail.in"));
			out = new PrintWriter("graphtail.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}