#include <bits/stdc++.h>
using namespace std;
template <typename T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
long double s_triangle(long double x1, long double y1, long double x2,
                       long double y2, long double x3, long double y3) {
  return abs(((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) / 2);
}
bool overflow(long long int a, long long int b) {
  if (a * b / b != a) return true;
  return false;
}
const int N = int(20000) + 5;
long long int t, n, m, k, cnt, l, r, ans, f, sum;
long long int a[N], b[N], c[N], d[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  vector<int> u, v;
  cin >> n >> m;
  for (long long int i = 0; i <= n - 1; i++) cin >> a[i];
  for (long long int i = 0; i <= n - 1; i++) cin >> b[i];
  for (long long int i = 0; i <= n - 1 - 1; i++) {
    u.push_back(a[i + 1] - a[i]);
    v.push_back(b[i + 1] - b[i]);
  }
  u.push_back(m - a[n - 1] + a[0]);
  v.push_back(m - b[n - 1] + b[0]);
  for (int j = 0; j < n; j++) {
    f = 1;
    for (int i = 0; i < n; i++) {
      if (u[i] != v[i]) {
        f = 0;
        break;
      }
    }
    if (f) {
      break;
    }
    t = v[0];
    v.erase(v.begin());
    v.push_back(t);
  }
  if (f == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
