#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-10;
double zero(double d) { return d < EPS ? 0.0 : d; }
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '(' << p.first << ',' << p.second << ')';
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (int i = 0; i < (int)(a.size()); i++) os << (i ? " " : "") << a[i];
  return os << ']';
}
string toString(int i) {
  stringstream ss;
  ss << i;
  return ss.str();
}
const int MOD = 1000000007;
long long fpow(long long a, long long k, int M) {
  long long res = 1ll;
  long long x = a;
  while (k != 0) {
    if ((k & 1) == 1) res = (res * x) % M;
    x = (x * x) % M;
    k >>= 1;
  }
  return res;
}
struct prepare {
  prepare() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(8);
    ios_base::sync_with_stdio(false);
  }
} _prepare;
int main() {
  int n, L;
  cin >> n >> L;
  vector<int> a(2 * n), b(2 * n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = n; i < (int)(2 * n); i++) a[i] = a[i - n];
  for (int i = 0; i < (int)(n); i++) cin >> b[i];
  for (int i = n; i < (int)(2 * n); i++) b[i] = b[i - n];
  vector<int> diff(n);
  for (int i = 0; i < (int)(n); i++) diff[i] = (a[i + 1] - a[i] + L) % L;
  for (int i = 0; i < (int)(n); i++) {
    bool ok = true;
    for (int j = 0; j < (int)(n); j++) {
      if (diff[j] != (b[i + j + 1] - b[i + j] + L) % L) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
