#include <bits/stdc++.h>
using namespace std;
int n, l, a[55], b[55], d, bb[55];
bool potrivire(int d) {
  int i;
  for (i = 0; i < n; i++) {
    bb[i] = b[i] + d;
    if (bb[i] >= l) {
      bb[i] = bb[i] - l;
    }
  }
  sort(bb, bb + n);
  for (i = 0; i < n; i++) {
    if (a[i] != bb[i]) return false;
  }
  return true;
}
int main() {
  int i;
  cin >> n >> l;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  d = 0;
  while ((d < l) && (!potrivire(d))) {
    d++;
  }
  if (d == l)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
