#include<iostream>
#include<algorithm>
using namespace std;
int n, t, x[100005], l, r;
int main() {
	cin >> n >> t;
	for (int i = 0; i < n; i++) {
		cin >> l >> r; x[l]++; x[r]--;
	}
	for (int i = 1; i <= t; i++)x[i] += x[i - 1];
	int maxn = 0;
	for (int i = 0; i < t; i++) {
		maxn = max(maxn, x[i]);
	}
	cout << maxn << endl;
	return 0;
}