#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000007;
const long long M = 1e9 + 7;
long long check(long long arr[], long long srr[], long long i, long long n) {
  for (long long j = 0; j < n; j++) {
    if (arr[j] != srr[(i + j) % n]) {
      return 0;
    }
  }
  return 1;
}
void normalise(long long srr[], long long i, long long n, long long num) {
  for (long long j = 0; j < n; j++) {
    srr[(i + j) % n] -= num;
  }
}
int main() {
  long long n, l;
  cin >> n >> l;
  long long arr[n], srr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n; i++) cin >> srr[i];
  long long numb = arr[0];
  for (long long i = 0; i < n; i++) {
    arr[i] -= numb;
  }
  numb = srr[0];
  for (long long i = 0; i < n; i++) {
    srr[i] -= numb;
  }
  long long num;
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  for (long long i = 0; i <= n - 1; i++) {
    if (check(arr, srr, i, n)) {
      cout << "YES" << endl;
      return 0;
    } else {
      srr[i] = l;
      num = srr[(i + 1) % n];
      normalise(srr, i, n, num);
    }
  }
  cout << "NO" << endl;
  return 0;
}
