#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
int N, L;
int main() {
  scanf("%d%d", &N, &L);
  vector<int> A(N), B(N);
  for (int i = (int)(0); i < (int)(N); i++) {
    scanf("%d", &A[i]);
  }
  for (int i = (int)(0); i < (int)(N); i++) {
    scanf("%d", &B[i]);
  }
  deque<int> X, Y;
  for (int i = (int)(0); i < (int)(N); i++) {
    if (i == N - 1) {
      X.push_back(A[0] + L - A[i]);
      Y.push_back(B[0] + L - B[i]);
    } else {
      X.push_back(A[i + 1] - A[i]);
      Y.push_back(B[i + 1] - B[i]);
    }
  }
  for (int i = (int)(0); i < (int)(N * 2); i++) {
    if (X == Y) {
      printf("YES\n");
      return 0;
    }
    X.push_back(X.front());
    X.pop_front();
  }
  printf("NO\n");
  return 0;
}
