#include <bits/stdc++.h>
using namespace std;
void add_self(int &a, int b) {
  a += b;
  if (a >= (int)1e9 + 7) a -= (int)1e9 + 7;
}
int n, l;
void f(vector<int> &a) {
  int x = a[0];
  for (int i = 0; i < n - 1; i++) {
    a[i] = a[i + 1] - a[i];
  }
  a[n - 1] = l - a[n - 1] + x;
}
void f1(vector<int> &a, int k) {
  reverse(begin(a), end(a));
  reverse(begin(a) + k, end(a));
  reverse(begin(a), begin(a) + k);
}
void solve() {
  cin >> n >> l;
  vector<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];
  f(a);
  f(b);
  for (int i = 0; i < n; i++) {
    f1(a, 1);
    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (a[j] != b[j]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "YES";
      return;
    }
  }
  cout << "NO";
}
int main() {
  ios::sync_with_stdio(false);
  int q = 1;
  for (int i = 1; i <= q; i++) {
    solve();
  }
}
