#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
const int MOD = 1e9 + 7;
const long long INF = 999999999999999;
inline string toStr(long long x) {
  string tmp = "";
  do tmp = char(x % 10 + '0') + tmp;
  while (x /= 10);
  return tmp;
}
inline long long toInt(string s) {
  long long res = 0;
  for (auto x : s) res = res * 10 + x - '0';
  return res;
}
int b[MAXN];
bool a[MAXN];
int main() {
  int n, L, x;
  cin >> n >> L;
  for (int i = 0, _a = (n); i < _a; ++i) cin >> x, a[x] = true;
  for (int i = 0, _a = (n); i < _a; ++i) cin >> b[i];
  for (int i = 0, _a = (L); i < _a; ++i) {
    int j = 0, cnt = 0;
    int cur = i;
    for (int k = 0, _a = (L); k < _a; ++k) {
      if (a[cur]) {
        if (cur < i)
          cnt += cur + L - i == b[j];
        else
          cnt += cur - i == b[j];
        ++j;
      }
      ++cur, cur %= L;
    }
    if (cnt == n) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
}
