#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l, i, j;
  cin >> n >> l;
  vector<long long> a(n), b(n);
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  vector<long long> sa, sb;
  for (i = 1; i < n; i++) sa.push_back(a[i] - a[i - 1]);
  sa.push_back(l - a[n - 1] + a[0]);
  for (i = 0; i < n; i++) {
    sb.clear();
    for (j = i + 1; j < n; j++) sb.push_back(b[j] - b[j - 1]);
    sb.push_back(l - b[n - 1] + b[0]);
    for (j = 1; j <= i; j++) sb.push_back(b[j] - b[j - 1]);
    if (sa == sb) break;
  }
  if (sa == sb)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
