#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
int x[50];
int main() {
  int n, l;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < (int)n; ++i) scanf("%d", x + i);
  for (int i = 1; i < (int)n; ++i) a.push_back(x[i] - x[i - 1]);
  a.push_back(x[0] + l - x[n - 1]);
  for (int i = 0; i < (int)n; ++i) scanf("%d", x + i);
  for (int i = 1; i < (int)n; ++i) b.push_back(x[i] - x[i - 1]);
  b.push_back(x[0] + l - x[n - 1]);
  for (int i = 0; i < (int)n; ++i)
    if (a == b)
      printf("YES\n"), exit(0);
    else {
      int t = a[0];
      for (int j = 1; j < (int)n; ++j) a[j - 1] = a[j];
      a[n - 1] = t;
    }
  printf("NO\n");
}
