#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, n, a[100], b[100], c[200], d[200];
  cin >> n >> l;
  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 < 200; i++) {
    c[i] = 0;
    d[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j) {
        int p, h, p1, h1;
        if (a[i] > a[j]) {
          p = a[j] - a[i] + l;
        } else
          p = a[i] - a[j] + l;
        h = abs(a[i] - a[j]);
        if (b[i] > b[j])
          p1 = b[j] - b[i] + l;
        else
          p1 = b[i] - b[j] + l;
        h1 = abs(b[i] - b[j]);
        c[p] += 1;
        c[h] += 1;
        d[p1] += 1;
        d[h1] += 1;
      }
    }
  }
  int f = 0;
  for (int i = 0; i < 200; i++) {
    if (c[i] != d[i]) f = 1;
  }
  if (f == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
