#include <bits/stdc++.h>   using namespace std;   int f[300010][2];   int dp[300010][2];   int Flag[300010];   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &f[i][0]);     for (int i = 1; i <= n; i++) scanf( %d , &f[i][1]);     if (k == 1) {       for (int ii = 0; ii < 2; ii++) {         int r = ii, s = ii ^ 1;         for (int i = 1; i <= n; i++) {           int nr = f[i][r], ns = f[i][s];           int ss = nr + ns;           if (nr != ((ss + 1) / 2) || ns != (ss / 2)) {             Flag[ii] = 1;             break;           }           if (ss & 1) swap(r, s);         }       }       if (Flag[1] && Flag[0])         puts( NO );       else         puts( YES );       return 0;     }     dp[0][0] = dp[0][1] = 0;     for (int i = 1; i <= n; i++) {       dp[i][0] = dp[i][1] = 0x3f3f3f3f;       for (int v = 0; v < 2; v++) {         int u = v ^ 1;         int r = dp[i - 1][v];         if (r != 0x3f3f3f3f) {           int x = f[i][v], y = f[i][u];           if (x >= y) {             if (x <= (k - r + (long long)k * y))               dp[i][v] = min((long long)dp[i][v],                              max(1LL, x - (k - r) - (long long)k * (y - 1)));             if (x <= ((long long)k * (y - 1) + k - r))               dp[i][u] = min(dp[i][u], 1);           } else {             if (y <= ((long long)k * (x + 1)))               dp[i][u] = min((long long)dp[i][u], max(1LL, y - (long long)k * x));             if (y <= ((long long)k * x)) dp[i][v] = min(dp[i][v], 1);           }         }       }     }     if (dp[n][0] == 0x3f3f3f3f && dp[n][1] == 0x3f3f3f3f)       puts( NO );     else       puts( YES );     return 0;   }   