#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, l;
  cin >> l >> n;
  int a[l], b[l], c[l], d[l];
  for (int i = 0; i < l; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < l; i++) {
    cin >> b[i];
  }
  for (int i = 1; i < l; i++) {
    c[i - 1] = a[i] - a[i - 1];
  }
  c[l - 1] = a[0] + (n - a[l - 1]);
  for (int i = 1; i < l; i++) {
    d[i - 1] = b[i] - b[i - 1];
  }
  d[l - 1] = b[0] + (n - b[l - 1]);
  int flag = 0;
  for (int i = 0; i < l; i++) {
    if (d[i] == c[0]) {
      flag = 1;
      int j = 0, t = i, counter = 0;
      while (counter < l) {
        if (d[t] != c[j]) {
          flag = 0;
          break;
        } else {
          j++;
          t++;
          if (t >= l) t = 0;
        }
        counter++;
      }
      if (flag == 1) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
