#include <bits/stdc++.h>
using namespace std;
struct data {
  int pos;
  long long cost;
  bool operator<(const data &p) const { return cost > p.cost; }
};
int k[107], s[107];
int kk[107], ss[107];
int main(void) {
  int n, l, i, j;
  cin >> n >> l;
  for (i = 0; i < n; i++) {
    cin >> k[i];
  }
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  for (i = 0; i < n - 1; i++) {
    kk[i] = k[i + 1] - k[i];
  }
  kk[i] = l - k[i] + k[0];
  for (i = 0; i < n - 1; i++) {
    ss[i] = s[i + 1] - s[i];
  }
  ss[i] = l - s[i] + s[0];
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (kk[(i + j) % n] != ss[j]) break;
    }
    if (j == n) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
