#include <bits/stdc++.h>
int kef[60], sas[60];
int main() {
  int n, L;
  scanf("%d %d", &n, &L);
  for (int i = 0; i < n; i++) scanf("%d", kef + i);
  for (int i = 0; i < n; i++) scanf("%d", sas + i);
  if (n == 1) {
    puts("YES");
    return 0;
  }
  int sum_kef = 0, sum_sas = 0;
  for (int i = n - 1; i > 0; i--) {
    kef[i] -= kef[i - 1];
    sas[i] -= sas[i - 1];
    sum_kef += kef[i];
    sum_sas += sas[i];
  }
  kef[0] = L - sum_kef;
  sas[0] = L - sum_sas;
  for (int i = 0; i < n; i++) {
    bool flag = true;
    for (int j = 0; j < n; j++) {
      if (kef[j] != sas[(i + j) % n]) flag = false;
    }
    if (flag) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
