#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<ctime>
#include<vector>
#include<string>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
using namespace std;
const int inf=2e9+9;
const int bit=31;
struct segment
{
int a,b,id;
bool operator <(const segment &temp)const
{
return a<temp.a;
}
};
segment sg[11111],nsg[11111];
struct pp
{
int id,vl;
bool operator <(const pp &temp)const
{
return vl<temp.vl;
}
};
pp list[11111];
int n,T,ch,ls[22222],cnt_ls;
int dp[11111];
int vec[10001][(10000/bit)+1],ii[10001][(10000)/bit+1],ni[(10000)/bit+1],nvec[(10000/bit)+1],on[10000/bit+1];
int one[10001][(10000/bit)+1];
map<int,int>hs;
vector<int>adj[11111];
int lowbit(int x)
{
return x&-x;
}
int upper_bound(int left,int right,int x)
{
int mid;
while(left<=right)
{
mid=(left+right)>>1;
if(ls[mid]<x)
left=mid+1;
else
right=mid-1;
}
return left;
}
void insert(int id,int flag,int vec[],int ii[],int one[])
{
int i,j,s,p,q,ix=id/bit;
if(flag>0)
vec[ix]|=(1<<(id%bit));
else
vec[ix]^=(1<<(id%bit));
one[ix]+=flag;
int sum=0;
ii[ix]=inf;
for(i=0;i<bit;i++)
{
if(vec[ix]&(1<<i))
{
sum++;
if(ii[ix]>list[ix*bit+i].vl-sum*T)
ii[ix]=list[ix*bit+i].vl-sum*T;
}
}
}
int find_min(int vec[],int ii[],int one[])
{
int i,ret=inf,sum=0;
for(i=0;i<=(n-1)/bit;i++)
{
if(ret>ii[i]-sum*T)
ret=ii[i]-sum*T;
sum+=one[i];
}
return ret;
}
int main()
{
scanf("%d%d",&n,&T);
int i,j,s,p,q,sum,nn,id,nowt,ip,ie,k,mb,nf;
int mi;
for(i=0;i<n;i++)
scanf("%d%d",&sg[i].a,&sg[i].b);
sort(sg,sg+n);
cnt_ls=0;
for(i=0;i<n;i++)
{
list[i].vl=sg[i].b;
list[i].id=i;
ls[cnt_ls++]=sg[i].a;
}
sort(ls,ls+cnt_ls);
nn=0;
for(i=0;i<cnt_ls;i++)
{
if(nn==0||ls[nn-1]<ls[i])
ls[nn++]=ls[i];
}
cnt_ls=nn;
hs.clear();
for(i=0;i<cnt_ls;i++)
hs[ls[i]]=i;
for(i=0;i<cnt_ls;i++)
adj[i].clear();
for(i=0;i<n;i++)
{
id=hs[sg[i].a];
adj[id].push_back(i);
}
sort(list,list+n);
for(i=0;i<n;i++)
sg[list[i].id].id=i;
i=0;
for(i=0;i<=cnt_ls;i++)
dp[i]=-inf;
dp[0]=inf;
memset(vec[0],0,sizeof(vec[0]));
memset(one[0],0,sizeof(one[0]));
for(i=0;i<=(n-1)/bit;i++)
ii[0][i]=inf;
int nxt=0;
for(i=0;i<cnt_ls;)
{
if(dp[i]<ls[i])
{
dp[i]=-inf;
i++;
continue;
}
for(j=0;j<=(n-1)/bit;j++)
{
nvec[j]=vec[i][j];
ni[j]=ii[i][j];
on[j]=one[i][j];
}
for(j=0;j<adj[i].size();j++)
{
ie=adj[i][j];
insert(sg[ie].id,1,nvec,ni,on);
}
nf=n;
for(j=0;j<=(n-1)/bit;j++)
{
if(nvec[j]>0)
{
for(s=0;s<bit;s++)
{
if(nvec[j]&(1<<s))
{
nf=j*bit+s;
break;
}
}
break;
}
}
mi=find_min(nvec,ni,on);
if(dp[i+1]<mi)
{
dp[i+1]=mi;
for(j=0;j<=(n-1)/bit;j++)
{
vec[i+1][j]=nvec[j];
ii[i+1][j]=ni[j];
one[i+1][j]=on[j];
}
}
ip=i+1;
nowt=ls[i];
id=upper_bound(0,cnt_ls-1,nowt+T);
if(nowt>mi)
{
i++;
continue;
}
while(true)
{
insert(nf,-1,nvec,ni,on);
bool hv=false;
for(j=ip;j<id;j++)
{
for(s=0;s<adj[j].size();s++)
{
ie=adj[j][s];
insert(sg[ie].id,1,nvec,ni,on);
if(sg[ie].id<=nf)
{
nf=sg[ie].id;
hv=true;
}
}
}
if(!hv)
{
for(j=nf/bit;j<=(n-1)/bit;j++)
{
if(nvec[j]>0)
{
for(s=0;s<bit;s++)
{
if(nvec[j]&(1<<s))
{
nf=j*bit+s;
break;
}
}
break;
}
}
if(j>(n-1)/bit)
nf=n;
}
if(id>ip)
{
mi=find_min(nvec,ni,on);
if(nowt+T>mi)
break;
}
nowt+=T;
ip=upper_bound(0,cnt_ls-1,nowt+T);
if(id<ip||nf==n)
{
mi=find_min(nvec,ni,on);
if(dp[id]<=mi)
{
dp[id]=mi;
for(j=0;j<=(n-1)/bit;j++)
{
vec[id][j]=nvec[j];
one[id][j]=on[j];
ii[id][j]=ni[j];
}
nxt=id;
}
else
break;
}
if(nf==n)
break;
swap(id,ip);
}
i=max(i+1,nxt-10);
if(dp[cnt_ls]>-inf)
{
for(j=0;j<=(n-1)/bit;j++)
{
if(vec[cnt_ls][j]!=0)
break;
}
if(j>(n-1)/bit)
{
puts("yes");
return 0;
}
}
}
if(dp[cnt_ls]>-inf)
{
for(j=0;j<=(n-1)/bit;j++)
{
if(vec[cnt_ls][j]!=0)
break;
}
if(j>(n-1)/bit)
{
puts("yes");
return 0;
}
}
puts("no");
return 0;
}
I2luY2x1ZGU8bWFwPiAgCiNpbmNsdWRlPHNldD4gIAojaW5jbHVkZTxzdGFjaz4gIAojaW5jbHVkZTxjbWF0aD4gIAojaW5jbHVkZTxjdGltZT4gIAojaW5jbHVkZTx2ZWN0b3I+ICAKI2luY2x1ZGU8c3RyaW5nPiAgCiNpbmNsdWRlPGJpdHNldD4gIAojaW5jbHVkZTxjc3RkaW8+ICAKI2luY2x1ZGU8Y3N0ZGxpYj4gIAojaW5jbHVkZTxjc3RyaW5nPiAgCiNpbmNsdWRlPGNsaW1pdHM+ICAKI2luY2x1ZGU8Y29tcGxleD4gIAojaW5jbHVkZTxpb3N0cmVhbT4gIAojaW5jbHVkZTxhbGdvcml0aG0+ICAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50ICBpbmY9MmU5Kzk7CmNvbnN0IGludCBiaXQ9MzE7CnN0cnVjdCBzZWdtZW50CnsKICAgIGludCBhLGIsaWQ7CiAgICBib29sIG9wZXJhdG9yIDwoY29uc3Qgc2VnbWVudCAmdGVtcCljb25zdAogICAgewogICAgICAgIHJldHVybiBhPHRlbXAuYTsKICAgIH0KfTsKc2VnbWVudCBzZ1sxMTExMV0sbnNnWzExMTExXTsKc3RydWN0IHBwCnsKICAgIGludCBpZCx2bDsKICAgIGJvb2wgb3BlcmF0b3IgPChjb25zdCBwcCAmdGVtcCljb25zdAogICAgewogICAgICAgIHJldHVybiB2bDx0ZW1wLnZsOwogICAgfQp9OwpwcCBsaXN0WzExMTExXTsKaW50IG4sVCxjaCxsc1syMjIyMl0sY250X2xzOwppbnQgZHBbMTExMTFdOwppbnQgdmVjWzEwMDAxXVsoMTAwMDAvYml0KSsxXSxpaVsxMDAwMV1bKDEwMDAwKS9iaXQrMV0sbmlbKDEwMDAwKS9iaXQrMV0sbnZlY1soMTAwMDAvYml0KSsxXSxvblsxMDAwMC9iaXQrMV07CmludCBvbmVbMTAwMDFdWygxMDAwMC9iaXQpKzFdOwptYXA8aW50LGludD5oczsKdmVjdG9yPGludD5hZGpbMTExMTFdOwppbnQgbG93Yml0KGludCB4KQp7CiAgICByZXR1cm4geCYteDsKfQppbnQgdXBwZXJfYm91bmQoaW50IGxlZnQsaW50IHJpZ2h0LGludCB4KQp7CiAgICBpbnQgbWlkOwogICAgd2hpbGUobGVmdDw9cmlnaHQpCiAgICB7CiAgICAgICAgbWlkPShsZWZ0K3JpZ2h0KT4+MTsKICAgICAgICBpZihsc1ttaWRdPHgpCiAgICAgICAgICAgbGVmdD1taWQrMTsKICAgICAgICBlbHNlCiAgICAgICAgICAgcmlnaHQ9bWlkLTE7CiAgICB9CiAgICByZXR1cm4gbGVmdDsKfQp2b2lkIGluc2VydChpbnQgaWQsaW50IGZsYWcsaW50IHZlY1tdLGludCBpaVtdLGludCBvbmVbXSkKewoJaW50IGksaixzLHAscSxpeD1pZC9iaXQ7CglpZihmbGFnPj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KG5uPT0wfHxsc1tubi0xXTxsc1tpXSkKICAgICAgICAgICBsc1tubisrXT1sc1tpXTsKICAgIH0KICAgIGNudF9scz1ubjsKICAgIGhzLmNsZWFyKCk7CiAgICBmb3IoaT0wO2k8Y250X2xzO2krKykKICAgICAgIGhzW2xzW2ldXT1pOwogICAgZm9yKGk9MDtpPGNudF9scztpKyspCiAgICAgICAgYWRqW2ldLmNsZWFyKCk7CiAgICBmb3IoaT0wO2k8bjtpKyspCiAgICB7CiAgICAgICAgaWQ9aHNbc2dbaV0uYV07CiAgICAgICAgYWRqW2lkXS5wdXNoX2JhY2soaSk7CiAgICB9CiAgICBzb3J0KGxpc3QsbGlzdCtuKTsKICAgIGZvcihpPTA7aTxuO2krKykKICAgICAgIHNnW2xpc3RbaV0uaWRdLmlkPWk7CiAgICBpPTA7CiAgICBmb3IoaT0wO2k8PWNudF9scztpKyspCiAgICAgICBkcFtpXT0taW5mOwogICAgZHBbMF09aW5mOwogICAgbWVtc2V0KHZlY1swXSwwLHNpemVvZih2ZWNbMF0pKTsKICAgIG1lbXNldChvbmVbMF0sMCxzaXplb2Yob25lWzBdKSk7CiAgICBmb3IoaT0wO2k8PShuLTEpL2JpdDtpKyspCiAgICAgICAgaWlbMF1baV09aW5mOwogICAgaW50IG54dD0wOwogICAgZm9yKGk9MDtpPGNudF9sczspCiAgICB7CiAgICAgICAgaWYoZHBbaV08bHNbaV0pCiAgICAgICAgewogICAgICAgICAgIGRwW2ldPS1pbmY7CiAgICAgICAgICAgaSsrOwogICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBmb3Ioaj0wO2o8PShuLTEpL2JpdDtqKyspCiAgICAgICAgewogICAgICAgICAgICBudmVjW2pdPXZlY1tpXVtqXTsKICAgICAgICAgICAgbmlbal09aWlbaV1bal07CiAgICAgICAgICAgIG9uW2pdPW9uZVtpXVtqXTsKICAgICAgICB9CiAgICAgICAgZm9yKGo9MDtqPGFkaltpXS5zaXplKCk7aisrKQogICAgICAgIHsKICAgICAgICAgICAgICBpZT1hZGpbaV1bal07CiAgICAgICAgICAgICAgaW5zZXJ0KHNnW2llXS5pZCwxLG52ZWMsbmksb24pOwogICAgICAgIH0KICAgICAgICBuZj1uOwogICAgICAgIGZvcihqPTA7ajw9KG4tMSkvYml0O2orKykKICAgICAgICB7CiAgICAgICAgCWlmKG52ZWNbal0+MCkKICAgICAgICAJewoJICAgICAgICAJZm9yKHM9MDtzPGJpdDtzKyspCgkgICAgICAgIAl7CgkgICAgICAgIAkJaWYobnZlY1tqXSYoMTw8cykpCgkgICAgICAgIAkJewoJCSAgICAgICAgCQluZj1qKmJpdCtzOwoJCSAgICAgICAgCQlicmVhazsKCQkgICAgICAgIAl9CgkgICAgICAgIAl9CgkgICAgICAgIAlicmVhazsKCSAgICAgICAgfQogICAgICAgIH0KICAgICAgICBtaT1maW5kX21pbihudmVjLG5pLG9uKTsKICAgICAgICBpZihkcFtpKzFdPG1pKQogICAgICAgIHsKICAgICAgICAgICAgZHBbaSsxXT1taTsKICAgICAgICAgICAgZm9yKGo9MDtqPD0obi0xKS9iaXQ7aisrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgIHZlY1tpKzFdW2pdPW52ZWNbal07CiAgICAgICAgICAgICAgIGlpW2krMV1bal09bmlbal07CiAgICAgICAgICAgICAgIG9uZVtpKzFdW2pdPW9uW2pdOwoJCQl9CgkJfQogICAgICAgIGlwPWkrMTsKICAgICAgICBub3d0PWxzW2ldOwogICAgICAgIGlkPXVwcGVyX2JvdW5kKDAsY250X2xzLTEsbm93dCtUKTsKICAgICAgICBpZihub3d0Pm1pKQogICAgICAgIHsKICAgICAgIAkgICBpKys7CiAgICAgICAgICAgY29udGludWU7CiAgICAgICAgfQogICAgICAgIHdoaWxlKHRydWUpCiAgICAgICAgewogICAgICAgICAgICBpbnNlcnQobmYsLTEsbnZlYyxuaSxvbik7CiAgICAgICAgICAgIGJvb2wgaHY9ZmFsc2U7CiAgICAgICAgICAgIGZvcihqPWlwO2o8aWQ7aisrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBmb3Iocz0wO3M8YWRqW2pdLnNpemUoKTtzKyspCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWU9YWRqW2pdW3NdOwogICAgICAgICAgICAgICAgICAgIGluc2VydChzZ1tpZV0uaWQsMSxudmVjLG5pLG9uKTsKICAgICAgICAgICAgICAgICAgICBpZihzZ1tpZV0uaWQ8PW5mKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICBuZj1zZ1tpZV0uaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgaHY9dHJ1ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYoIWh2KQogICAgICAgICAgICB7CiAgICAgICAgICAgIAlmb3Ioaj1uZi9iaXQ7ajw9KG4tMSkvYml0O2orKykKICAgICAgICAgICAgCXsKCSAgICAgICAgICAgIAlpZihudmVjW2pdPjApCgkgICAgICAgICAgICAJewoJICAgICAgICAgICAgCQlmb3Iocz0wO3M8Yml0O3MrKykKCSAgICAgICAgICAgIAkJewoJCSAgICAgICAgICAgIAkJaWYobnZlY1tqXSYoMTw8cykpCgkJICAgICAgICAgICAgCQl7CgkJICAgICAgICAgICAgCQkJbmY9aipiaXQrczsKCQkgICAgICAgICAgICAJCQlicmVhazsKCQkgICAgICAgICAgICAJCX0KCQkgICAgICAgICAgICAJfQoJICAgICAgICAgICAgCQlicmVhazsKCSAgICAgICAgICAgIAl9CgkgICAgICAgICAgICB9CgkgICAgICAgICAgICBpZihqPihuLTEpL2JpdCkKCSAgICAgICAgICAgICAgICBuZj1uOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmKGlkPmlwKQogICAgICAgICAgICB7CiAgICAgICAgICAgIAltaT1maW5kX21pbihudmVjLG5pLG9uKTsKICAgICAgICAgICAgICAgICBpZihub3d0K1Q+bWkpCiAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBub3d0Kz1UOwogICAgICAgICAgICBpcD11cHBlcl9ib3VuZCgwLGNudF9scy0xLG5vd3QrVCk7CiAgICAgICAgICAgIGlmKGlkPGlwfHxuZj09bikKICAgICAgICAgICAgewogICAgICAgICAgICAJbWk9ZmluZF9taW4obnZlYyxuaSxvbik7CiAgICAgICAgICAgICAgICBpZihkcFtpZF08PW1pKQogICAgICAgICAgICAgICAgeyAKICAgICAgICAgICAgICAgICAgIGRwW2lkXT1taTsKICAgICAgICAgICAgICAgICAgIGZvcihqPTA7ajw9KG4tMSkvYml0O2orKykKICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgIAkgICB2ZWNbaWRdW2pdPW52ZWNbal07CiAgICAgICAgICAgICAgICAgICAJICAgb25lW2lkXVtqXT1vbltqXTsKICAgICAgICAgICAgICAgICAgIAkgICBpaVtpZF1bal09bmlbal07CiAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICBueHQ9aWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZihuZj09bikKICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIHN3YXAoaWQsaXApOwogICAgICAgIH0KICAgICAgICBpPW1heChpKzEsbnh0LTEwKTsKICAgICAgICBpZihkcFtjbnRfbHNdPi1pbmYpCiAgICAgICAgewogICAgICAgICAgICBmb3Ioaj0wO2o8PShuLTEpL2JpdDtqKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmKHZlY1tjbnRfbHNdW2pdIT0wKQogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmKGo+KG4tMSkvYml0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBwdXRzKCJ5ZXMiKTsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgaWYoZHBbY250X2xzXT4taW5mKQogICAgewogICAgICAgIGZvcihqPTA7ajw9KG4tMSkvYml0O2orKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKHZlY1tjbnRfbHNdW2pdIT0wKQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgICAgIGlmKGo+KG4tMSkvYml0KQogICAgICAgIHsKICAgICAgICAgICAgcHV0cygieWVzIik7CiAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgIH0KICAgIHB1dHMoIm5vIik7CiAgICByZXR1cm4gMDsKfQ==