#include<stdio.h>
#define TMAX 100000
int main(void){
	int N, T, time[TMAX]={0}, in, out, max=0, i, j;
	scanf("%d%d", &N, &T);
	for(i=0; i<N; i++){
		scanf("%d%d", &in, &out);
		for(j=in; j<out; j++){
			*(time+j) += 1;
			if(max < *(time+j)){
				max = *(time+j);
			}
		}
	}
	printf("%d\n", max);
	return 0;
}