#include <bits/stdc++.h>
using namespace std;
std::vector<int> v;
int is[345];
int val;
int main() {
  int N, L;
  scanf("%d%d", &N, &L);
  for (int i = 0; i < N; i++) {
    scanf("%d", &val);
    is[val] = 1;
  }
  for (int i = 0; i < N; i++) {
    scanf("%d", &val);
    v.push_back(val);
  }
  for (int i = 0; i < L; i++) {
    int flag = 1;
    for (int j = 0, k = 0; j < L; j++) {
      {}
      if (is[(i + j) % L] == 1) {
        if (j == v[k])
          k++;
        else {
          flag = 0;
          break;
        }
      }
    }
    if (flag == 0) continue;
    printf("YES\n");
    return 0;
  }
  printf("NO\n");
  return 0;
}
