#include <bits/stdc++.h>
using namespace std;
int a[100004];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, l, k;
  cin >> n >> l;
  int b[l + 1];
  for (int i = 1; i <= l; i++) {
    a[i] = i;
    b[i] = 0;
  }
  for (int i = 1; i <= l; i++) {
    a[i + l] = i;
  }
  int ba[n + 1];
  int ca[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> ba[i];
    b[ba[i] + 1] = 1;
  }
  vector<int> c;
  for (int i = 1; i <= n; i++) {
    cin >> ca[i];
    c.push_back(ca[i]);
  }
  vector<int> v;
  bool flag = false;
  for (int i = 1; i <= l; i++) {
    for (int j = 0; j <= l - 1; j++) {
      if (b[a[i + j]] == 1) {
        v.push_back(j);
      }
    }
    if (v == c) flag = true;
    v.clear();
  }
  if (flag == true)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
