#include <bits/stdc++.h>
using namespace std;
const int dx4[5] = {0, -1, 0, 1, 0};
const int dy4[5] = {0, 0, 1, 0, -1};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int maxn = 1e2 + 20;
const double PI = acos(-1.0);
const long long mod = 1e9 + 7;
long long po(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  } else {
    return gcd(b % a, a);
  }
}
int n, len;
int val1[maxn], val2[maxn];
int ans1[maxn], ans2[maxn];
void solve() {
  scanf("%d", &(n)), scanf("%d", &(len));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &(val1[i]));
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &(val2[i]));
  }
  for (int i = 2; i <= n; i++) {
    ans1[i - 2] = val1[i] - val1[i - 1];
    ans2[i - 2] = val2[i] - val2[i - 1];
  }
  ans1[n - 1] = len - (val1[n] - val1[1]);
  ans2[n - 1] = len - (val2[n] - val2[1]);
  int flag = 0;
  for (int k = 0; k <= 2 * n; k++) {
    int i;
    for (i = 0; i < n; i++) {
      if (ans1[i] != ans2[(i + k) % n]) {
        break;
      }
    }
    if (i == n) {
      flag = 1;
    }
  }
  if (flag) {
    puts("YES");
  } else {
    puts("NO");
  }
}
int main() {
  solve();
  return 0;
}
