#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, L;
  cin >> n >> L;
  vector<int> distA(n), distB(n);
  for (int i = 0; i < n; i++) {
    cin >> distA[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> distB[i];
  }
  vector<bool> track(L + 10, false);
  int curPos = 0;
  for (int i = 0; i < n; i++) {
    int distance = max(0, distA[i] - 1);
    if (i > 0) {
      distance = distA[i] - distA[i - 1];
    }
    curPos += distance;
    track[curPos] = true;
  }
  bool matches = false;
  for (int start = 0; start < L; start++) {
    curPos = start;
    bool valid = true;
    int curDist = 0, curBlock = 0;
    while (curBlock < n) {
      if (track[curPos]) {
        if (curDist != distB[curBlock]) {
          valid = false;
          break;
        }
        curBlock++;
      }
      curPos = (curPos + 1) % L;
      curDist++;
    }
    if (valid) {
      cout << "YES"
           << "\n";
      return 0;
    }
  }
  cout << "NO"
       << "\n";
}
