#include <bits/stdc++.h>
int a[100], b[100], chaa[100], chab[100];
int main() {
  int n, l, cnt = 0;
  scanf("%d %d", &n, &l);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnt++;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  a[0] = a[cnt];
  b[0] = b[cnt];
  for (int i = 0; i < n; i++) {
    if (a[i + 1] - a[i] > 0)
      chaa[i] = (a[i + 1] - a[i]);
    else {
      chaa[i] = l - a[i] + a[i + 1];
    }
    if (b[i + 1] - b[i] > 0)
      chab[i] = (b[i + 1] - b[i]);
    else {
      chab[i] = l - b[i] + b[i + 1];
    }
  }
  for (int i = 0; i < n; i++) {
    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (chab[(j + i) % n] != chaa[j % n]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}
