#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  vector<int> a, b, x, y;
  for (int i = 0; i < n; i++) {
    int o;
    cin >> o;
    a.push_back(o);
    if (i) {
      int t;
      t = abs(a[i] - a[i - 1]);
      x.push_back(t);
    }
  }
  int k = (l - abs(a[n - 1] - a[0]));
  x.push_back(k);
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    b.push_back(p);
    if (i) {
      int h;
      h = abs(b[i] - b[i - 1]);
      y.push_back(h);
    }
  }
  k = (l - abs(b[n - 1] - b[0]));
  y.push_back(k);
  for (int i = 0; i < n; i++) {
    vector<int>::iterator g = y.begin() + i;
    vector<int> s(g, y.end());
    if (i) {
      s.insert(s.end(), y.begin(), g);
    }
    if (equal(s.begin(), s.end(), x.begin())) {
      cout << "YES";
      return 0;
    }
    s.clear();
  }
  cout << "NO";
}
