#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std; 
int d[100010],a[100010],l,r,ans=0,n,t;
int main()
{
    scanf("%d%d",&n,&t);
    memset(d,0,sizeof(d));
    memset(a,0,sizeof(a));
    for(int i=1;i<=n;++i)
	{
        scanf("%d%d",&l,&r);
        d[l]+=1;
        d[r]-=1;
    }
    for(int i=0;i<=t;++i) a[i]=a[i-1]+d[i];
    for(int i=0;i<t;++i) ans=max(ans,a[i]);
    printf("%d\n",ans);
    return 0;
}
