#include <bits/stdc++.h>
using namespace std;
const double eps = 1E-9;
const double Exp = 2.718281828459045;
const double pi = 3.14159;
const double E = 2.7182818284590452354;
const int Max_Bit = 63;
const int INF = 2000000000;
const long long LINF = 1000000000000000007ll;
const int MOD = 1000000007;
const int NMAX = 105;
const int MMAX = 105;
const int base = 1000 * 1000 * 1000;
int main() {
  int n, l, a[NMAX], b[NMAX];
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    bool ok = true;
    int p = (a[0] + l - b[0 + i]) % l;
    for (int j = 1; j < n; j++) {
      if ((a[j] + l - b[(j + i) % n]) % l != p) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
