#include <bits/stdc++.h>
using namespace std;
void getCircle(vector<int>& circle, int n, int l) {
  int prev, cur;
  cin >> prev;
  circle.push_back(prev);
  cur = prev;
  for (int i = 0; i < n - 1; i++) {
    cin >> cur;
    circle.push_back(cur - prev);
    prev = cur;
  }
  circle[0] += l - cur;
}
bool compareCircles(vector<int>& fCircle, vector<int>& sCircle, int n) {
  for (int i = 0; i < n; i++) {
    if (fCircle == sCircle) return true;
    fCircle.push_back(fCircle[0]);
    fCircle.erase(fCircle.begin());
  }
  return false;
}
int main() {
  int n, l;
  cin >> n >> l;
  vector<int> fCircle, sCircle;
  getCircle(fCircle, n, l);
  getCircle(sCircle, n, l);
  if (compareCircles(fCircle, sCircle, n))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
