#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  int l1[100], l2[100];
  for (int i = 0; i < n; i++) {
    cin >> l1[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> l2[i];
  }
  int l_1[100], l_2[100];
  for (int i = 1; i <= n; i++) {
    int x = i - 1;
    if (i == n) {
      l_1[x] = l - (l1[x] - l1[0]);
      l_2[x] = l - (l2[x] - l2[0]);
    } else {
      l_1[x] = l1[i] - l1[x];
      l_2[x] = l2[i] - l2[x];
    }
  }
  for (int i = 0; i < n; i++) {
    int c = 0;
    for (int j = i, x = 0; x < n; x++) {
      if (j == n) j = 0;
      if (l_1[x] == l_2[j]) c += 1;
      j += 1;
    }
    if (c == n) {
      cout << "YES\n";
      exit(0);
    }
  }
  cout << "NO\n";
}
