#include <bits/stdc++.h>
using namespace std;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int dx2[] = {+1, -1, 0, 0, +1, +1, -1, -1};
int dy2[] = {0, 0, +1, -1, +1, -1, -1, +1};
long long squ(long long x) { return (x * x); }
long long power(long long bs, long long k) {
  long long x = 1, y = bs;
  if (k == 0) return 1;
  while (k > 0) {
    if (k % 2 == 1) x = (x * y);
    y *= y;
    k /= 2;
  }
  return (x);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.unsetf(ios::floatfield);
  cout.precision(6);
  cout.setf(ios::fixed, ios::floatfield);
  ;
  int n, l, a[1000], b[1000], i, j, pt[1000], pv = 0;
  memset(pt, 0, sizeof(pt));
  cin >> n >> l;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    pt[a[i]] = 1;
  }
  for (i = 0; i < n; i++) cin >> b[i];
  int cnt;
  for (i = 0; i < l; i++) {
    cnt = 0;
    pv = i;
    for (j = 0; j < n; j++) {
      if (pt[(b[j] + pv) % l] == 1) {
        cnt++;
      } else
        break;
    }
    if (cnt == n) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
