#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int arr1[n], arr2[n];
  for (int i = 0; i < n - 1; i++) {
    arr1[i] = a[i + 1] - a[i];
    arr2[i] = b[i + 1] - b[i];
  }
  arr1[n - 1] = l - a[n - 1] + a[0];
  arr2[n - 1] = l - b[n - 1] + b[0];
  int x = arr1[0];
  for (int i = 0; i < n; i++) {
    if (arr2[i] == x) {
      bool isSame = true;
      for (int j = 0; j < n && isSame; j++)
        if (arr2[(i + j) % n] != arr1[j]) isSame = false;
      if (isSame) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
