#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const long long int mod = 1e9 + 7;
long long int pow(long long int x, long long int y) {
  long long int res = 1;
  while (y > (long long int)0) {
    if (y & (long long int)1) res = ((res) * (x));
    y = y >> (long long int)1;
    x = ((x) * (x));
  }
  return res;
}
void solve() {
  long long int i, j, k, ans, a, b, c, mx, mn, t, n, m, x, temp, p, q, y, z, l,
      r, g, flg, sum, d, cnt, sumf, diff, odd, even;
  cin >> n >> a;
  vector<long long int> arr1(n), arr2(n), sasha, kefa;
  for (i = 0; i < n; i++) cin >> arr1[i];
  for (i = 0; i < n; i++) cin >> arr2[i];
  for (i = 1; i < n; i++) sasha.push_back(arr1[i] - arr1[i - 1]);
  sasha.push_back(arr1[0] + a - arr1[n - 1]);
  for (i = 1; i < n; i++) kefa.push_back(arr2[i] - arr2[i - 1]);
  kefa.push_back(arr2[0] + a - arr2[n - 1]);
  for (i = 0; i < n; i++) sasha.push_back(sasha[i]);
  for (i = 0; i < n; i++) {
    flg = 0;
    for (j = 0; j < n; j++) {
      if (sasha[i + j] != kefa[j]) {
        flg = 1;
        break;
      }
    }
    if (flg == 0) break;
  }
  if (flg == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
}
