#include <bits/stdc++.h>
using namespace std;
int main() {
  int s1[55], s2[55];
  int p1[55], p2[55];
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    scanf("%d", &s1[i]);
  }
  for (int i = 0; i < n; i++) scanf("%d", &s2[i]);
  for (int i = 0; i < n; i++) {
    if (i == 0)
      p1[i] = s1[i] + l - s1[n - 1];
    else
      p1[i] = s1[i] - s1[i - 1];
  }
  for (int i = 0; i < n; i++) {
    if (i == 0)
      p2[i] = s2[i] + l - s2[n - 1];
    else
      p2[i] = s2[i] - s2[i - 1];
  }
  int flag = 1;
  for (int i = 0; i < n; i++) {
    flag = 1;
    for (int j = 0; j < n; j++) {
      if (p1[j] != p2[(j + i) % n]) {
        flag = 0;
        break;
      }
    }
    if (flag) break;
  }
  if (flag)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
