#include <bits/stdc++.h>
using namespace std;
int a[2000];
int b[2000];
int res[2000];
int main() {
  int n, l;
  while (cin >> n >> l) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(res, 0, sizeof(res));
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      b[x] = 1;
    }
    for (int i = 0; i < l; i++) {
      b[l + i] = b[i];
    }
    sort(a, a + n);
    a[n] = a[0] + l;
    for (int i = 0; i < n; i++) res[i] = a[i + 1] - a[i];
    int flag = 0;
    for (int i = 0; i < 2 * l; i++) {
      if (flag == 1) break;
      if (b[i] == 1) {
        int temp = i;
        int k = 0;
        for (k = 0; k < n; k++) {
          temp += res[k];
          if (!b[temp]) break;
        }
        if (k == n) flag = 1;
      }
    }
    flag == 1 ? cout << "YES" << endl : cout << "NO" << endl;
  }
  return 0;
}
