#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, n;
  cin >> n >> l;
  vector<int> a;
  vector<int> b;
  int x, y;
  int i;
  for (i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  for (i = 0; i < n; i++) {
    cin >> x;
    b.push_back(x);
  }
  for (i = 1; i < n; i++) {
    a[i] = a[i] - a[0];
    b[i] = b[i] - b[0];
  }
  a[0] = 0;
  b[0] = 0;
  if (a == b) {
    cout << "YES";
    return 0;
  }
  int flag;
  vector<int> temp;
  for (i = 1; i < n; i++) {
    flag = 0;
    temp.clear();
    for (int j = 0; j < n; j++) {
      if (a[i] + b[j] >= l) {
        temp.push_back(a[i] + b[j] - l);
      } else
        temp.push_back(a[i] + b[j]);
    }
    sort(temp.begin(), temp.end());
    if (temp == a) {
      cout << "YES";
      goto avi;
    }
  }
  cout << "NO";
avi:
  return 0;
}
