#include <bits/stdc++.h>
using namespace std;
int l, n, a[55], b[55], c[55], d[55];
int main() {
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 1; i < n; i++) c[i] = a[i] - a[i - 1];
  c[0] = a[0] + l - a[n - 1];
  for (int i = 1; i < n; i++) d[i] = b[i] - b[i - 1];
  d[0] = b[0] + l - b[n - 1];
  for (int i = 0; i < n; i++) {
    bool f = 1;
    for (int j = i; j < n; j++) {
      if (c[j - i] != d[j]) f = 0;
    }
    for (int j = 0; j < i; j++) {
      if (c[j + n - i] != d[j]) f = 0;
    }
    if (f) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
}
