#include <bits/stdc++.h>
using namespace std;
int n, l;
deque<int> a, b;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> l;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    b.push_back(x);
  }
  if (n == 1) {
    cout << "YES";
    return 0;
  }
  bool bn;
  for (int j = 0; j < n; j++) {
    bn = 0;
    for (int i = 1; i < n; i++) {
      if (abs(a[i] - a[i - 1]) != abs(b[i] - b[i - 1])) {
        bn = 1;
        break;
      }
    }
    if (bn) {
      x = b.back();
      b.push_front(x);
      b.pop_back();
      x = l - x;
      for (int i = 0; i < n; i++) b[i] = (b[i] + x) % l;
    } else {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
