#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	int n, w;
	cin >> n >> w;
	vector<pair<int, int>>sim;

	for(int i = 0; i<n; ++i){
		int s, t, p;
		cin >> s >> t >> p;
		sim.push_back(make_pair(s, p));
		sim.push_back(make_pair(t, -p));
	}

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

	ll curr = 0;
	for(auto i : sim){
		curr += i.second;
		if(curr > w){
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";
	return 0;
}

/*
https://atcoder.jp/contests/abc200/tasks/abc200_e

## 題意：


## 思路：

*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 0x3fffffff;
const ll LINF = 9223372036854775807;
#define dump(x) cout << #x << " = " << (x) << endl
#define ALL(x) begin(x),end(x)
#define rep(i,s,e) for(ll i=(s); i<=(e); ++i)
#define repRev(i,s,e) for(ll i=(s); i>=(e); --i)
#define range(i,s,n) for(ll i=(s), i_stop=(s)+(n); i<i_stop; ++i)
#define rangeRev(i,s,n) for(ll i=(s), i_stop=(s)-(n); i>i_stop; --i)
template<typename T> bool chmax(T& a, const T b) {if(a<b) {a=b;return true;} return false;}
template<typename T> bool chmin(T& a, const T b) {if(a>b) {a=b;return true;} return false;}

int n,m; 
list<pair<int,int>> restri[110];

bool check(int msk) {
    int l=0; vector<int> tot(n+1, 0);
    range(i,0,n) if(msk & (1<<i)) {
        ++l; ++tot[i];
    }
    rep(i,1,n-1) tot[i] += tot[i-1];

    for(auto &p:restri[l]) {
        auto [y,z] = p;
        if(tot[y] > z) return false;
    }
    return true;
}

void solve() {
    cin>>n>>m;
    
    range(i,0,m) {
        int x,y,z; cin>>x>>y>>z;
        restri[x].push_back({y-1,z});
    }

   
    vector<ll> dp(1<<n, 0); dp[0] = 1;
    range(msk, 0, 1<<n) range(nxt, 0, n) if(!(msk & (1<<nxt))) {
        if(check(msk | (1<<nxt))) 
            dp[msk | (1<<nxt)] += dp[msk];
    }

    cout<<dp[(1<<n)-1]<<endl;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}

    
    