#include <bits/stdc++.h>
using namespace std;
int N, K, M, tc, L;
int a[110], b[110];
int p[110];
int main() {
  scanf("%d%d", &N, &L);
  for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= N; i++) scanf("%d", &b[i]);
  for (int i = 0; i <= L; i++) {
    for (int j = 1; j <= N; j++) {
      p[j] = (b[j] + i) % L;
    }
    sort(p + 1, p + 1 + N);
    bool ok = true;
    for (int j = 1; j <= N; j++) {
      if (a[j] != p[j]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
