#include <bits/stdc++.h>
using namespace std;
const int max_n = 110;
int a[max_n], b[max_n];
int main() {
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    bool flag = true;
    for (int j = 0; j < n; j++) {
      int dis1, dis2;
      if (a[(j + i) % n] > a[(j + 1 + i) % n])
        dis1 = l - a[(j + i) % n] + a[(j + 1 + i) % n];
      else
        dis1 = a[(j + i + 1) % n] - a[(j + i) % n];
      if (b[j] > b[(j + 1) % n])
        dis2 = l - b[j] + b[(j + 1) % n];
      else
        dis2 = b[(j + 1) % n] - b[j];
      if (dis1 != dis2) {
        flag = false;
        break;
      }
    }
    if (flag) return cout << "YES" << endl, 0;
  }
  cout << "NO" << endl;
  return 0;
}
