#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  constexpr int T = 200000;
  int n, w; cin >> n >> w;
  vector<ll> water(T + 1, 0);
  while (n--) {
    int s, t, p; cin >> s >> t >> p;
    water[s] += p;
    water[t] -= p;
  }
  REP(i, T) water[i + 1] += water[i];
  cout << (*max_element(ALL(water)) <= w ? "Yes\n" : "No\n");
  return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

struct UnionFind {
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}

  int find(int x) {
    if(d.at(x) < 0) return x;
    return d.at(x) = find(d.at(x));
  }

  bool unite(int a, int b) {
    a = find(a); b = find(b);
    if (a == b) return false;
    if (d.at(a) > d.at(b)) swap(a, b);
    d.at(a) += d.at(b); d.at(b) = a; 
    return true;
  }

  bool same(int a, int b) {
    return find(a) == find(b);
  }

  int size(int x) {
    return -d.at(find(x));
  }
};

int main()
{
  int n, m;
  cin >> n >> m;
  vector<ll> a(n), b(n);
  UnionFind uf(n);
  rep(i, n) cin >> a.at(i);
  rep(i, n) cin >> b.at(i);
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    uf.unite(x, y);
  }
  map<ll, ll> am, bm;
  rep(i, n) {
    am[uf.find(i)] += a.at(i);
    bm[uf.find(i)] += b.at(i);
  }
  for (auto it = am.begin(); it != am.end(); it++) {
    if (it->second != bm[it->first]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
  return 0;
}