#include <bits/stdc++.h>
using namespace std;
int n, l, ans = 1;
vector<int> a(100), b(100), c, d;
bool check() {
  bool ok = 1;
  for (int i = 0; i < n; i++)
    if (c[i] != d[i]) ok = 0;
  return ok;
}
void rotate() {
  int t = c[0];
  c.erase(c.begin());
  c.push_back(t);
}
void preprocess() {}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(17);
  cin >> n >> l;
  string good = "NO";
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n - 1; i++) {
    c.push_back(a[i + 1] - a[i]);
    d.push_back(b[i + 1] - b[i]);
  }
  c.push_back(l - a[n - 1] + a[0]);
  d.push_back(l - b[n - 1] + b[0]);
  for (int i = 0; i < n; i++) {
    if (check()) good = "YES";
    rotate();
  }
  cout << good;
  return 0;
}
