#include <bits/stdc++.h>
using namespace std;
auto rng = bind(uniform_int_distribution<int>(0, 25), mt19937(time(0)));
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << '\n'; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug &>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug &>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug &operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug &operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
template <class T>
bool umin(T &a, const T &b) {
  return (a > b ? a = b, 1 : 0);
}
template <class T>
bool umax(T &a, const T &b) {
  return (a < b ? a = b, 1 : 0);
}
const int N = 3e5 + 1;
int dp[N][2];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> y[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i + 1][0] = dp[i + 1][1] = 2e9;
    int p1 = (x[i] + k - 1) / k;
    int p2 = (y[i] + k - 1) / k;
    if (p1 - y[i] > 1 || p2 - x[i] > 1) {
      cout << "NO";
      return 0;
    }
    int c = 0;
    int mxcan = (dp[i][c ^ 1] != 2e9 ? k : k - dp[i][c]);
    auto placex = [&](int first, int last, int pl1, int v, int l, int r) {
      last = max(last, 0);
      if (!first || v < first + last) return;
      if (first > pl1) return;
      int groupsmn = ceil((long double)(v - first));
      int my = (last ? 2 : 1) + ceil((long double)(v - first - last) / k);
      int need = (last ? my - 1 : my);
      int w = (last ? c : c ^ 1);
      if (need == r && last) {
        umin(dp[i + 1][w], last);
      } else if (!last) {
        int l1 = need, r1 = (last ? 2 : 1) + (v - first - last);
        int l2 = l, r2 = r;
        l2 = max(l1, l2);
        r2 = min(r1, r2);
        if (l2 > r2) return;
        if (r2 == l)
          umin(dp[i + 1][w], (r % k == 0 ? k : r % k));
        else {
          umin(dp[i + 1][w], 1);
        }
      } else {
        if (l <= need && r >= need) umin(dp[i + 1][w], last);
      }
    };
    placex(mxcan, 0, mxcan, x[i], p2, y[i]);
    placex(mxcan, k, mxcan, x[i], p2, y[i]);
    placex(mxcan, (x[i] - mxcan) % k, mxcan, x[i], p2, y[i]);
    placex(mxcan, 1, mxcan, x[i], p2, y[i]);
    placex(1, 1, mxcan, x[i], p2, y[i]);
    placex(x[i], 1, mxcan, x[i], p2, y[i]);
    placex(1, 0, mxcan, x[i], p2, y[i]);
    c ^= 1;
    mxcan = (dp[i][c ^ 1] != 2e9 ? k : k - dp[i][c]);
    swap(x[i], y[i]);
    swap(p1, p2);
    placex(mxcan, 0, mxcan, x[i], p2, y[i]);
    placex(1, 0, mxcan, x[i], p2, y[i]);
    placex(mxcan, (x[i] - mxcan) % k, mxcan, x[i], p2, y[i]);
    placex(mxcan, k, mxcan, x[i], p2, y[i]);
    placex(mxcan, 1, mxcan, x[i], p2, y[i]);
    placex(1, 1, mxcan, x[i], p2, y[i]);
    placex(x[i], 1, mxcan, x[i], p2, y[i]);
  }
  if (dp[n][0] != 2e9 || dp[n][1] != 2e9) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
