#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, l, i, a[1000], b[1000], s1[1000], s2[1000];
  cin >> n >> l;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) cin >> b[i];
  long long int temp = 0;
  for (i = 2; i <= n; i++) {
    s1[i - 1] = a[i] - a[i - 1];
    temp += s1[i - 1];
  }
  s1[n] = l - temp;
  temp = 0;
  for (i = 2; i <= n; i++) {
    s2[i - 1] = b[i] - b[i - 1];
    temp += s2[i - 1];
  }
  s2[n] = l - temp;
  long long int flag = 0;
  for (i = 1; i <= n; i++) {
    long long int flag1 = 1;
    long long int temp1[1000];
    long long int k = 1, j;
    for (j = n - i + 1; j <= n; j++) temp1[k++] = s1[j];
    for (j = 1; j <= n - i; j++) temp1[k++] = s1[j];
    for (j = 1; j <= n; j++) {
      if (s2[j] != temp1[j]) {
        flag1 = 0;
        break;
      }
    }
    if (flag1 == 1) {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
