#include <bits/stdc++.h>
using namespace std;
int ni() {
  int val;
  scanf("%i", &val);
  return val;
}
int64_t nll() {
  int64_t val;
  scanf("%I64d", &val);
  return val;
}
char nc() {
  char val;
  do {
    scanf("%c", &val);
  } while (val == ' ' || val == '\r' || val == '\n');
  return val;
}
char ncs() {
  char val;
  do {
    scanf("%c", &val);
  } while (false);
  return val;
}
string ns() {
  static char buff[1024 * 2000];
  scanf("%s", buff);
  return string{buff};
}
int64_t gcd(int64_t a, int64_t b) {
  while (b) {
    auto tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
const int64_t max_n = 3 * 1000 * 100 + 1;
template <typename T>
inline int sign(const T& val) {
  return val < 0 ? -1 : (val > 0 ? +1 : 0);
}
void ret(bool res) {
  if (res)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  exit(0);
}
int main() {
  auto n = ni(), l = ni();
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) a[i] = ni();
  for (int i = 0; i < n; ++i) b[i] = ni();
  vector<int> ad(n), bd(n);
  for (int i = 0; i < n; ++i) {
    if (i + 1 < n) {
      ad[i] = a[1 + i] - a[i];
      bd[i] = b[1 + i] - b[i];
    } else {
      ad[i] = l - a[i] + a[0];
      bd[i] = l - b[i] + b[0];
    }
  }
  for (int s = 0; s < n; ++s) {
    if (ad == bd) ret(true);
    bd.insert(bd.begin(), bd.back());
    bd.pop_back();
  }
  ret(false);
  return 0;
}
