#include<stdio.h>
#define TMAX 10000
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;
		}
	}
	for(i=0; i<T; i++){
		max = (max < *(time+i) ? *(time+i) : max);
	}
	printf("%d\n", max);
	return 0;
}