#include <bits/stdc++.h>
using namespace std;
long long n, l;
vector<long long> a, b, aa, bb, used1, used2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a.push_back(x);
  }
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    b.push_back(x);
  }
  aa.push_back(a[0] + (l - a[n - 1]));
  bb.push_back(b[0] + (l - b[n - 1]));
  for (long long i = n - 1; i > 0; i--) {
    aa.push_back(a[i] - a[i - 1]);
    bb.push_back(b[i] - b[i - 1]);
  }
  for (long long i = 0; i < aa.size(); i++) {
    used1.clear();
    for (long long j = i; j < bb.size(); j++) {
      used1.push_back(bb[j]);
    }
    for (long long j = 0; j < i; j++) {
      used1.push_back(bb[j]);
    }
    long long cnt = 0;
    for (long long j = 0; j < aa.size(); j++) {
      if (aa[j] != used1[j]) cnt = 1;
    }
    if (cnt == 0) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
