#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
const int INF = (1ll << 31) - 1;
int a[2][N];
int d[N][2];
inline int dv(int aa, int bb) { return (aa - 1) / bb + 1; }
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[0][i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[1][i]);
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 2; ++j) {
      int pa = d[i - 1][j];
      int pb = d[i - 1][j ^ 1];
      d[i][j] = INF;
      if (d[i - 1][j] != INF && a[j ^ 1][i] == dv(pa + a[j][i], k) - 1)
        d[i][j] =
            min(d[i][j], !((pa + a[j][i]) % k) ? k : ((pa + a[j][i]) % k));
      if (d[i - 1][j] != INF && a[j ^ 1][i] > dv(pa + a[j][i], k) - 1 &&
          a[j][i] > dv(a[j ^ 1][i], k) - 1)
        d[i][j] = min(d[i][j], 1);
      if (d[i - 1][j ^ 1] != INF && a[j ^ 1][i] == dv(a[j][i], k) - 1)
        d[i][j] = min(d[i][j], !(a[j][i] % k) ? k : (a[j][i] % k));
      if (d[i - 1][j ^ 1] != INF && a[j][i] > dv(pb + a[j ^ 1][i], k) - 1 &&
          a[j ^ 1][i] > dv(a[j][i], k) - 1)
        d[i][j] = min(d[i][j], 1);
    }
  printf(d[n][0] != INF || d[n][1] != INF ? "YES" : "NO");
  return 0;
}
