#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)1e5 + 77;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, l, x;
  cin >> n >> l;
  int a[111], b[111];
  vector<int> u, v;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a[i];
    if (i > 0) {
      x = a[i] - a[i - 1];
      u.push_back(x);
    }
  }
  u.push_back(l - a[n - 1] + a[0]);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> b[i];
    if (i > 0) {
      x = b[i] - b[i - 1];
      v.push_back(x);
    }
  }
  v.push_back(l - b[n - 1] + b[0]);
  vector<int> t;
  for (int i = 0; i < (int)(n); ++i) {
    t = u;
    rotate(t.begin(), t.begin() + i, t.end());
    if (t == v) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
