#include <bits/stdc++.h>
using namespace std;
int n, l, x, y;
int a[102];
int b[51];
string result;
int main() {
  cin >> n >> l;
  for (int i = 1; i <= n; i++) cin >> a[i];
  x = a[1];
  for (int i = 1; i < n; i++) a[i] = a[i + 1] - a[i];
  a[n] = x + l - a[n];
  for (int i = 1; i <= n; i++) cin >> b[i];
  y = b[1];
  for (int i = 1; i < n; i++) b[i] = b[i + 1] - b[i];
  b[n] = y + l - b[n];
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (b[j] != a[i + j - 1]) {
        result = "NO";
        break;
      }
      if (j == (n)) result = "YES";
    }
    if (result == "YES") break;
  }
  cout << result << endl;
  return 0;
}
