#include <bits/stdc++.h>
using namespace std;
bool equal(vector<int> &A, vector<int> &B) {
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  return A == B;
}
int main() {
  int n, l, i, j, k, item;
  bool flag = false;
  vector<int> V1, V2;
  cin >> n >> l;
  if (n <= l) {
    vector<int> A(n), B(n);
    for (i = 0; i < n; ++i) {
      cin >> item;
      V1.push_back(item);
    }
    for (i = 0; i < n; ++i) {
      cin >> item;
      V2.push_back(item);
    }
    for (i = 0; i < l; ++i) {
      for (j = 0; j < l; ++j) {
        for (k = 0; k < V1.size(); ++k) {
          A[k] = V1[k] + i;
          A[k] %= l;
        }
        for (k = 0; k < V2.size(); ++k) {
          B[k] = V2[k] + j;
          B[k] %= l;
        }
        if (equal(A, B)) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
    cout << "NO" << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}
