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