#include<bits/stdc++.h>
using namespace std;
int main(){
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  int D = abs(r1-r2) + abs(c1-c2);
  int64_t Ap = r1 + c1;
  int64_t Am = r1 - c1;
  int64_t Bp = r2 + c2;
  int64_t Bm = r2 - c2;
  //0回
  if(r1 == r2 && c1 == c2){
    cout << 0 << endl;
    return 0;
  }
  //1回？
  if(Ap == Bp || Am == Bm){
    cout << 1 << endl;
    return 0;
  }
  if(D <= 3){
    cout << 1 << endl;
    return 0;
  }
  //2回？
  for(int i=-3; i<=3; i++){
    for(int j=-3; j<=3; j++){
      if(abs(i) + abs(j) > 3){
        continue;
      }
      if(Ap == Bp + i + j || Am == Bm + i + j){
        cout << 2 << endl;
        return 0;
      }
    }
  }
  if(Ap %2 == Bp %2){
    cout << 2 << endl;
    return 0;
  }
  if(D <= 6){
    cout << 2 << endl;
    return 0;
  }
  //3回
  cout << 3 << endl;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << ' ';
    }
    return os;
}
int main() {
    int n;
    ll w;
    cin >> n >> w;
    vector<ll> v(200200);
    rep(i, n) {
        int s, t;
        ll p;
        cin >> s >> t >> p;
        v[s] += p;
        v[t] -= p;
    }
    rep(i, 200200 - 1) v[i + 1] += v[i];
    if (*max_element(all(v)) <= w)
        cout << "Yes\n";
    else
        cout << "No\n";
}