#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
//https://www.hustyx.com/cpp/5/ -- reference
#define N 100005
int a[N];

int main(){
	//input
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	memset(a,0,N);
	int n,t,l,r;
	scanf("%d %d",&n,&t);
	for(int i = 0; i<n; i++){
		scanf("%d %d",&l,&r);
		a[l]++;
		a[r]--;
	}
	//preprocess in the array
	int max = 0;
	int count = 0;
	for(int i = 0; i<N; i++){
		count += a[i];
		if(max<count) max = count;
	}
	printf("%d\n",max);
	//printf("wei");
	return 0;
}
