N,M=map(int,input().split()) H=[0]*(M+1) for n in range(N):L,R=map(int,input().split());H[L]+=1;H[R+1]-=1;H[M-R-1]+=1;H[M-L]-=1 for h in H: n+=h if n>1+N:n+=1 print(['NO','YES'][n