#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  if (a[n - 1] > l || b[n - 1] > l) return cout << "NO", 0;
  vector<int> v1, v2;
  v1.push_back(l - a[n - 1] + a[0]);
  v2.push_back(l - b[n - 1] + b[0]);
  for (int i = 1; i < n; i++) {
    v1.push_back(a[i] - a[i - 1]);
  }
  for (int i = 1; i < n; i++) {
    v2.push_back(b[i] - b[i - 1]);
  }
  int k = 0;
  if (v1.size() != v2.size())
    return cout << "NO", 0;
  else {
    for (int i = 0; i < v1.size(); i++) {
      int x = v1[0];
      v1.erase(v1.begin());
      v1.push_back(x);
      if (v1 == v2) return cout << "YES", 0;
    }
  }
  cout << "NO";
}
