#include <bits/stdc++.h>
#define mod 1000000007
#define MOD 1000000007
#define ll long long int
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MAXN 100009 
#define pi 3.1415926535897932384626

using namespace std;

ll power(ll x, ll y) { ll ans = 1; x %= MOD; while (y) {if (y & 1)ans = (x * ans) % MOD; x = (x * x) % MOD; y >>= 1;} return ans;}
ll modInv(ll n) { return power(n, MOD - 2);}


void solve()
{
    ll n, k, i, ans=0;
    cin>>n>>k;
    ll a[n+9], b[n+9];
    vector<pair<ll, ll>> v;
    for(i=0; i<n; i++)
    {
        cin>>a[i]>>b[i];
        v.push_back({a[i], b[i]});
    }

    sort(v.begin(), v.end());

    for(i=0; i<n; i++)
    {
        if(k>=v[i].first)
        {
            k+=v[i].second;
        }
        else
        {
            break;
        }
    }
    cout<<k;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fastio
    ll t=1; 
    // cin>>t;
    
    while(t--)
    {
        solve();
    }
}
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>

#define int long long

using namespace std;

const int N = 1e6 + 10, M = 2e6 + 10, inf = 0x3f3f3f3f;

const long long Linf = 0x3f3f3f3f3f3f3f3f;

inline int read() {
	bool sym = 0; int res = 0; char ch = getchar();
	while (!isdigit(ch)) sym |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
	return sym ? -res : res;
}

int n, m, cnt, now, vis[N], dat[N], l[N], r[N], t[N];

signed main() {
	n = read(); int k = read();
	for (int i = 1; i <= n; i++) {
		l[i] = read(); r[i] = read(); t[i] = read();
	}
	for (int i = 1; i <= n; i++) {
		vis[l[i]] += t[i]; vis[r[i]] -= t[i]; m = max(m, r[i]);
	}
	for (int i = 0; i <= m; i++) {
		now += vis[i]; if (now > k) {printf("No"); return 0;}
	}
	printf("Yes");
	return 0;
}