#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  int a[100], b[100];
  int aa[100], bb[100];
  scanf("%d%d", &n, &l);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i < n; i++) aa[i] = a[i + 1] - a[i];
  aa[0] = l - a[n] + a[1];
  for (int i = 1; i < n; i++) bb[i] = b[i + 1] - b[i];
  bb[0] = l - b[n] + b[1];
  int flag = 0;
  for (int i = 0; i < n; i++) {
    int flag1 = 1;
    for (int j = 0; j < n; j++)
      if (aa[(j + i) % n] != bb[j]) {
        flag1 = 0;
        break;
      }
    if (flag1) flag = 1;
  }
  printf(flag ? "YES\n" : "NO\n");
  return 0;
}
