// AOJ DSL_5_A The Maximum Number of Customers
// 2018.5.5 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int s[100002];

// imos法で解く
int main()
{
	int N, T, i, ans;

	N = in(), T = in();
	for (i = 0; i < N; i++) {
		s[in()]++, s[in()]--;
	}
	ans = s[0];
	for (i = 1; i <= T; i++) {
		s[i] += s[i-1];
		if (s[i] > ans) ans = s[i];
	}
	printf("%d\n", ans);
	return 0;
}

