#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return GCD(b, a % b);
  }
}
int main() {
  long long n, L, i, j, s = 0, c = 0, val = 0, er = 0, yo = 0;
  cin >> n >> L;
  long long a[n + 1], b[n + 1];
  vector<long long> dif1, dif2;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n - 1; i++) {
    dif1.push_back(abs(a[i + 1] - a[i]));
  }
  dif1.push_back(abs(L - a[n - 1]) + a[0]);
  for (i = 0; i < n - 1; i++) {
    dif2.push_back(abs(b[i + 1] - b[i]));
  }
  dif2.push_back(abs(L - b[n - 1]) + b[0]);
  s = 0;
  val = 0;
  for (i = 0; i < n; i++) {
    c = 0;
    s = val;
    er = 0;
    yo = 0;
    while (c < n) {
      s = s % n;
      if (dif1[s] != dif2[yo]) {
        er = 1;
        break;
      }
      s++;
      yo++;
      c++;
    }
    if (er == 0) {
      cout << "YES";
      exit(0);
      ;
    }
    val++;
  }
  cout << "NO";
  return 0;
  ;
}
