#include <bits/stdc++.h>
using namespace std;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
int A[101], B[101], sum1[101], sum2[101];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  ;
  for (int(i) = (int)(0); (i) < (int)(n); ++(i)) cin >> A[i];
  for (int(i) = (int)(0); (i) < (int)(n); ++(i)) cin >> B[i];
  sum1[0] = A[0] + k - A[n - 1];
  sum2[0] = B[0] + k - B[n - 1];
  for (int(i) = (int)(1); (i) < (int)(n); ++(i)) {
    sum1[i] = A[i] - A[i - 1];
    sum2[i] = B[i] - B[i - 1];
  }
  int flag = 0;
  for (int(i) = (int)(0); (i) < (int)(n); ++(i)) {
    for (int(j) = (int)(0); (j) < (int)(n); ++(j)) {
      if (sum1[i] == sum2[j]) {
        int counti = 0;
        for (int(k) = (int)(0); (k) < (int)(n); ++(k)) {
          if (sum1[(k + i) % n] == sum2[(j + k) % n]) counti = counti + 1;
        }
        if (counti == n) flag = 1;
      }
    }
  }
  if (flag == 1)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
