#include <bits/stdc++.h>
using namespace std;
const int N = 107;
int arr[N], a[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> v1;
  for (int i = 1; i < n; ++i) {
    v1.push_back(arr[i] - arr[i - 1]);
  }
  v1.push_back((l - arr[n - 1]) + arr[0]);
  vector<int> v2;
  for (int i = 1; i < n; ++i) {
    v2.push_back(a[i] - a[i - 1]);
  }
  v2.push_back((l - a[n - 1]) + a[0]);
  bool flag;
  for (int i = 0, j = 0; j < n; ++j) {
    if (v2[j] == v1[i]) {
      flag = true;
      for (int k = j; k < n; ++k, ++i) {
        if (v2[k] != v1[i]) {
          i = 0;
          flag = false;
          break;
        }
      }
      if (flag) {
        for (int k = 0; k < j; ++k, ++i) {
          if (v2[k] != v1[i]) {
            i = 0;
            flag = false;
            break;
          }
        }
      }
      if (flag) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  cout << "NO\n";
  return 0;
}
