#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, l;
  cin >> n >> l;
  vector<int> v(n), u(n);
  for (int i = 0; i < v.size(); ++i) {
    cin >> v[i];
  }
  for (int j = 0; j < u.size(); ++j) {
    cin >> u[j];
  }
  bool valid = false;
  for (int i = 0; i < u.size() and !valid; ++i) {
    valid = true;
    for (int j = 0; j < u.size() and valid; ++j) {
      if (v[j] - v[0] != (u[(i + j) % n] - u[i] + l) % l) {
        valid = false;
      }
    }
  }
  if (valid)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
