#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, L;
  cin >> n >> L;
  vector<int> lis1, lis2;
  int s, a;
  cin >> a;
  s = a;
  for (int i = 1; i < n; i++) {
    int b;
    cin >> b;
    lis1.push_back(b - a);
    a = b;
  }
  lis1.push_back(s + L - a);
  cin >> a;
  s = a;
  for (int i = 1; i < n; i++) {
    int b;
    cin >> b;
    lis2.push_back(b - a);
    a = b;
  }
  lis2.push_back(s + L - a);
  vector<int> temp = lis2;
  for (int i = 0; i < n; i++) {
    if (temp == lis1) {
      cout << "YES";
      return 0;
    }
    lis2 = temp;
    temp.clear();
    for (int i = 1; i < n; i++) temp.push_back(lis2[i]);
    temp.push_back(lis2[0]);
  }
  cout << "NO";
  return 0;
}
