#include <bits/stdc++.h>
using namespace std;
int a[55], b[55];
int diffA[55], diffB[55];
int main() {
  int n, l, i, j;
  scanf("%d %d", &n, &l);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) scanf("%d", &b[i]);
  for (i = 0; i < n - 1; i++) diffA[i] = a[i + 1] - a[i];
  diffA[n - 1] = a[0] + l - a[n - 1];
  for (i = 0; i < n - 1; i++) diffB[i] = b[i + 1] - b[i];
  diffB[n - 1] = b[0] + l - b[n - 1];
  for (i = 0; i < n; i++) {
    for (j = i; j < i + n; j++)
      if (diffA[j - i] != diffB[j % n]) break;
    if (j == i + n) return !printf("YES");
  }
  puts("NO");
  return 0;
}
