#include <bits/stdc++.h>
const int MAX_N = 51;
int v1[MAX_N], v2[MAX_N], dist1[MAX_N], dist2[MAX_N];
inline bool comp(int off, int n) {
  bool ok;
  int i = 0;
  while (i < n && dist1[i] == dist2[(i + off) % n]) ++i;
  return i == n;
}
int main() {
  int n, l;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) scanf("%d", &v1[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &v2[i]);
  for (int i = n - 1; i >= 0; --i) {
    v1[i] -= v1[0];
    v2[i] -= v2[0];
  }
  v1[n] = v2[n] = l;
  for (int i = 0; i < n; ++i) {
    dist1[i] = v1[i] - v1[i + 1];
    dist2[i] = v2[i] - v2[i + 1];
  }
  int i = 0;
  while (i < n && !comp(i, n)) ++i;
  if (i < n)
    printf("YES");
  else
    printf("NO");
  return 0;
}
