#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, C;
    cin >> N >> C;
    vector<pair<int, int>> event;
    REP(i, N) {
        int a, b, c;
        cin >> a >> b >> c;
        event.emplace_back(a - 1, c);
        event.emplace_back(b, -c);
    }
    sort(ALL(event));
    int ans = 0, fee = 0, t = 0;
    for (auto [x, y] : event) {
        if (x != t) {
            ans += min(C, fee) * (x - t);
            t = x;
        }
        fee += y;
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}

#include<bits/stdc++.h>
using namespace std;
long long used[222222];
int s[222222];
int t[222222];
int main()
{
	long long n,w;
	cin>>n>>w;
	for(int i=0;i<n;i++)
	{
		long long p;
		cin>>s[i]>>t[i]>>p;
		used[s[i]]+=p;
		used[t[i]]-=p;
	}
	for(int i=0;i<=200000;i++)
	{
		used[i]+=used[i-1];
		if(used[i]>w)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
	
}