#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(long long num, int idx) { return ((num >> idx) & 1ll) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
int n, k, F[300009], T[300009];
int main() {
  cin >> n >> k;
  int f, t;
  for (int i = 0; i < n; i++) cin >> T[i];
  for (int i = 0; i < n; i++) cin >> F[i];
  int op = 2, ls, lastrem = 0, currem;
  for (int i = 0; i < n; i++) {
    t = T[i];
    f = F[i];
    int v1;
    if (t < f) {
      v1 = f / (k) + (f % (k) != 0);
      if (t < v1 - 1) {
        cout << "NO\n";
        return 0;
      }
      if (f % k != 0)
        currem = f % k;
      else
        currem = k;
      if (op == 1) {
        if (t == v1 - 1 && ls == 0) {
          if (lastrem + currem <= k) {
            currem = k;
          } else {
            cout << "NO\n";
            return 0;
          }
        } else if (ls == 0 && t > v1 - 1) {
          t -= 1;
          currem = max(0, currem - (k - lastrem));
        }
      }
      if (t == v1 - 1)
        op = 1, ls = 0;
      else
        op = 2;
      lastrem = currem;
    } else if (f < t) {
      v1 = t / (k) + (t % (k) != 0);
      if (f < v1 - 1) {
        cout << "NO\n";
        return 0;
      }
      if (t % k != 0)
        currem = t % k;
      else
        currem = k;
      if (op == 1) {
        if (f == v1 - 1 && ls == 1) {
          if (lastrem + currem <= k) {
            currem = k;
          } else {
            cout << "NO\n";
            return 0;
          }
        } else if (ls == 1 && f > v1 - 1) {
          f -= 1;
          currem = max(0, currem - (k - lastrem));
        }
      }
      if (f == v1 - 1)
        op = 1, ls = 1;
      else
        op = 2;
      lastrem = currem;
    } else {
      if (op == 1) {
        if ((lastrem + 1 <= k) || (k >= 2 && f >= 2)) {
          op = 2;
        } else {
          op = 1;
          ls = ls;
          lastrem = 1;
        }
      } else {
        op = 2;
      }
    }
  }
  cout << "YES\n";
}
