#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; template void psort(vector &u, vector &v, bool isGreater=false){ int n = (int)u.size(); vector> vecP(n); for(int i = 0; i < n; ++i){ vecP[i].first = u[i]; vecP[i].second = v[i]; } if(isGreater){ sort(vecP.rbegin(), vecP.rend()); } else{ sort(vecP.begin(), vecP.end()); } for(int i = 0; i < n; ++i){ u[i] = vecP[i].first; v[i] = vecP[i].second; } } int main(){ int N, M; while(cin >> N >> M){ vi L(N), R(N); rep(i, N){ scanf("%d%d", &L[i], &R[i]); R[i]++; int l = M - R[i], r = M - L[i]; if(l < L[i]){ L[i] = l; R[i] = r; } } psort(L, R); vector dp(N + 1, vi(M, -1)); dp[0][0] = M; rep(i, N){ rep(l, M)if(dp[i][l] >= l){ int r = dp[i][l]; if(l <= L[i] && R[i] <= r)smax(dp[i + 1][R[i]], r); int nl = M - R[i], nr = M - L[i]; if(l <= nl && nr <= r)smax(dp[i + 1][l], nl); } } int ok = 0; rep(l, M)ok |= l<=dp[N][l]; puts(ok ? "YES" : "NO"); } }