#include <bits/stdc++.h>
using namespace std;
int a[205], b[205], La[205], Lb[205];
int n, L;
int main() {
  int yes;
  while (~scanf("%d %d", &n, &L)) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
    for (int i = 1; i < n; i++) {
      La[i] = a[i + 1] - a[i];
      Lb[i] = b[i + 1] - b[i];
    }
    La[n] = L - a[n] + a[1], Lb[n] = L - b[n] + b[1];
    yes = 0;
    for (int i = 1; i <= n; i++) {
      int B = 1;
      for (int j = 1; j <= n; j++) {
        int id = (i + j - 1) % n;
        if (!id) id = n;
        if (La[j] != Lb[id]) {
          B = 0;
          break;
        }
      }
      if (B) {
        yes = 1;
        break;
      }
    }
    if (yes)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
