#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define x first
#define y second
#define bg begin()
#define ed end()
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define R(i,n) for(int i(0);i<(n);++i)
#define L(i,n) for(int i((n)-1);~i;--i)
const int iinf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;

//Data
const int N=2e5;
int n,m; ll c[N+5];

//Main
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>m;
    R(i,n){
        int s,t,v;
        cin>>s>>t>>v;
        c[s]+=v,c[t]-=v;
    }
    R(i,N+3){
        if(c[i]>m) cout<<"No\n",exit(0);
        c[i+1]+=c[i];
    }
    cout<<"Yes\n";
    return 0;
}
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<iterator>
#include<string>
#include<sstream>
#include <unordered_map>
#include<cmath>
using namespace std;
#define ll long long
int __gcd(int a,int b){return b==0 ? a : __gcd(b,a%b);}
ll __gcd(ll a,ll b){return b==0 ? a : __gcd(b,a%b);}

const int maxn=5100;
int a[maxn],t[maxn],c[maxn],g[maxn];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    int _=1;
    while(_--){
        int n; cin>>n;
        string s; cin>>s;

        if(s[0]=='A') a[0]++;
        else if(s[0]=='T') t[0]++;
        else if(s[0]=='C') c[0]++;
        else if(s[0]=='G') g[0]++;

        for(int i=1;i<n;++i){
            a[i]=a[i-1]; t[i]=t[i-1]; c[i]=c[i-1]; g[i]=g[i-1];
            if(s[i]=='A') a[i]++;
            else if(s[i]=='T') t[i]++;
            else if(s[i]=='C') c[i]++;
            else if(s[i]=='G') g[i]++;
        }
        int ans=0;
        //cout<<t]<<endl;
        
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j){
                int A=0,T=0,C=0,G=0;
                if(i>0){
                    A=a[j]-a[i-1]; T=t[j]-t[i-1]; C=c[j]-c[i-1]; G=g[j]-g[i-1];
                } else{
                    A=a[j]; T=t[j]; C=c[j]; G=g[j];
                }
               // if(i==1&&j==3) cout<<A<<" "<<T<<" "<<C<<" "<<G<<endl;
                if(A==T&&C==G) ++ans;
            }
        }
        cout<<ans<<"\n";
    }
}