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