#include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N, L;
  cin >> N >> L;
  V<int> A(N), B(N);
  for (auto &e : A) {
    cin >> e;
  };
  for (auto &e : B) {
    cin >> e;
  };
  V<int> locs(L);
  for (int a : A) {
    locs[a] = 1;
  }
  for (int(st) = 0; (st) < (L); ++(st)) {
    V<int> D;
    for (int(j) = 0; (j) < (L); ++(j)) {
      int loc = (st + j) % L;
      if (locs[loc]) {
        D.push_back(j);
      }
    }
    if (D == B) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
