#include <bits/stdc++.h>
using namespace std;
long long n, k, l, s, x[100001], y[100001];
int main() {
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) cin >> y[i];
  for (int i = 0; i < n; i++) {
    k = 1;
    s = (y[i] - x[0] + l) % l;
    for (int j = 0; j < n; j++)
      if ((x[j] + s) % l != y[(i + j) % n]) {
        k = 0;
        break;
      }
    if (k) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
