#include <bits/stdc++.h>
using namespace std;
int a[10005], b[10005], c[10005], d[10005];
int n, L, cnt = 0, cnt1 = 0;
void debug() {
  for (int i = 1; i <= n; i++) printf("%d %d\n", c[i], d[i]);
}
bool check(int x) {
  int j = 1;
  for (int i = x; i <= n; i++) {
    if (c[i] == d[j])
      j++;
    else
      return false;
  }
  for (int i = 1; i < x; i++) {
    if (c[i] == d[j])
      j++;
    else
      return false;
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 2; i <= n; i++) c[++cnt] = a[i] - a[i - 1];
  c[++cnt] = (L - a[n]) + a[1];
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  sort(b + 1, b + n + 1);
  for (int i = 2; i <= n; i++) d[++cnt1] = b[i] - b[i - 1];
  d[++cnt1] = (L - b[n]) + b[1];
  for (int i = 1; i <= n; i++) {
    if (check(i)) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
