#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long const max_size = 2000005;
long long int power(long long int a, long long int b, long long int m) {
  long long int res = 1, curr = a;
  while (b) {
    if (b & 1) res = (res * curr) % m;
    curr = (curr * curr) % m;
    b = b >> 1;
  }
  return res;
}
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while (a % b) {
    int temp = a;
    a = b;
    b = temp % a;
  }
  return b;
}
vector<int> adj[100005];
long long int vst[100005] = {0};
vector<long long int> s1, s2;
int bfs(int s) {
  queue<int> que;
  int c1, c2, flag = 2;
  vst[s] = 1;
  s1.push_back(s);
  que.push(s);
  c1 = 1;
  c2 = 0;
  while (!que.empty()) {
    while (c1) {
      int u = que.front();
      que.pop();
      c1--;
      for (int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if (!vst[v]) {
          c2++;
          que.push(v);
          vst[v] = 1;
        }
      }
    }
    c1 = c2;
    c2 = 0;
  }
  return 1;
}
void dfs(int u) {
  vst[u] = 1;
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i];
    if (vst[v] == 0) dfs(v);
  }
  return;
}
int comp(pair<int, string> a, pair<int, string> b) { return a.first < b.first; }
long long int primec[100005] = {0};
void primeFactors(int n) {
  if (n % 2 == 0) primec[2]++;
  while (n % 2 == 0) {
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    if (n % i == 0) primec[i]++;
    while (n % i == 0) {
      n = n / i;
    }
  }
  if (n > 2) primec[n]++;
}
long long int lb(long long int a[], long long int l, long long int h,
                 long long int n, long long int key) {
  if (l > h) return INT_MIN;
  int m = (l + h) / 2;
  if (a[m] <= key && (m == n - 1 || a[m + 1] > key))
    return a[m];
  else if (a[m] > key)
    return lb(a, l, m - 1, n, key);
  else
    return lb(a, m + 1, h, n, key);
}
long long int ub(long long int a[], long long int l, long long int h,
                 long long int n, long long int key) {
  if (l > h) return INT_MAX;
  int m = (l + h) / 2;
  if (a[m] >= key && (m == 0 || a[m - 1] < key))
    return a[m];
  else if (a[m] < key)
    return ub(a, m + 1, h, n, key);
  else
    return ub(a, l, m - 1, n, key);
}
int isPrime(int num) {
  for (int i = 2; i <= sqrt(num); i++) {
    if (num % i == 0) return 0;
  }
  return 1;
}
int main(int argv, char** args) {
  long long int t, l, k, d, x, y, p, q, r, g, u, v, w, prev, next,
      curr = 0, sum = 0, ans = 0, pos, neg, count = 0, flag = 1, dist, type,
      val, len, pre, n, m, start = 0, dis, ind;
  long long int i, j, a[100005] = {0}, b[100005] = {0};
  map<char, long long int> M;
  set<long long int> s1, s2;
  scanf("%lld%lld", &n, &l);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]), s1.insert(a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &b[i]), s2.insert(b[i]);
  }
  for (i = 1; i < l; i++) {
    if (s1 == s2) {
      cout << "YES\n";
      return 0;
    }
    s2.clear();
    for (j = 0; j < n; j++) {
      if (b[j] >= i)
        s2.insert(b[j] - i);
      else
        s2.insert(b[j] - i + l);
    }
  }
  if (s1 == s2) {
    cout << "YES\n";
    return 0;
  } else
    cout << "NO\n";
  return 0;
}
