#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<int> kefa(N), sasha(N);
  for (int n = 0; n < N; n++) {
    cin >> kefa[n];
  }
  for (int n = 0; n < N; n++) {
    cin >> sasha[n];
  }
  vector<int> dKefa(N), dSasha(N);
  int prev = kefa.back() - L;
  for (int n = 0; n < N; n++) {
    dKefa[n] = kefa[n] - prev;
    prev = kefa[n];
  }
  prev = sasha.back() - L;
  for (int n = 0; n < N; n++) {
    dSasha[n] = sasha[n] - prev;
    prev = sasha[n];
  }
  for (int n = 0; n < N; n++) {
    bool sameTrack = true;
    for (int m = 0; m < N; m++) {
      if (dKefa[(m + n) % N] != dSasha[m]) {
        sameTrack = false;
        break;
      }
    }
    if (sameTrack) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
