#include <bits/stdc++.h>
const long long INF = 1e16;
const long double eps = 1e-7;
const long double eps2 = 1e-10;
using namespace std;
long long n, k;
long long check_a(long long p, long long a, long long b) {
  if ((a + p + k - 1) / k > b + 1) return -1;
  if ((b + k - 1) / k >= a + 1) return -1;
  if ((a + p + k - 1) / k == b + 1) {
    if ((a + p) % k) return (a + p) % k;
    return k;
  }
  return 1;
}
long long check_b(long long p, long long a, long long b) {
  if ((a + p + k - 1) / k >= b + 1) return -1;
  if ((b + k - 1) / k > a + 1) return -1;
  if ((b + k - 1) / k == a + 1) {
    if (b % k == 0) return k;
    return b % k;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  vector<long long> A[2];
  A[0].resize(n);
  A[1].resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[0][i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> A[1][i];
  }
  long long DP[2] = {0, 0};
  long long new_DP[2];
  for (long long i = 0; i < n; i++) {
    new_DP[0] = INF;
    new_DP[1] = INF;
    if (DP[0] < INF) {
      long long ans1 = check_a(DP[0], A[0][i], A[1][i]);
      long long ans2 = check_b(DP[0], A[0][i], A[1][i]);
      if (ans1 > 0) new_DP[0] = min(new_DP[0], ans1);
      if (ans2 > 0) new_DP[1] = min(new_DP[1], ans2);
    }
    if (DP[1] < INF) {
      long long ans2 = check_a(DP[1], A[1][i], A[0][i]);
      long long ans1 = check_b(DP[1], A[1][i], A[0][i]);
      if (ans1 > 0) new_DP[0] = min(new_DP[0], ans1);
      if (ans2 > 0) new_DP[1] = min(new_DP[1], ans2);
    }
    DP[0] = new_DP[0];
    DP[1] = new_DP[1];
    if (DP[0] == INF && DP[1] == INF) {
      return cout << "NO", 0;
    }
  }
  cout << "YES";
  return 0;
}
