#include <bits/stdc++.h>
using namespace std;
typedef vector<long long int> vl;
int main() {
  int n, sz, i, x;
  cin >> n >> sz;
  vector<int> a, b, diff1, diff2;
  bool flag = true;
  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 = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      diff1.push_back((sz - a[j] + a[i]));
      diff2.push_back(sz - b[j] + b[i]);
      diff1.push_back(a[j] - a[i]);
      diff2.push_back(b[j] - b[i]);
    }
  }
  sort(diff1.begin(), diff1.end());
  sort(diff2.begin(), diff2.end());
  for (i = 0; i < diff1.size(); i++) {
    if (diff1[i] != diff2[i]) {
      flag = false;
      break;
    }
  }
  if (!flag) {
    cout << "NO\n";
  } else
    cout << "YES\n";
  return 0;
}
