#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n, l;     cin >> n >> l;     vector<int> a(n, 0), b(n, 0);     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     if (n == 1)       cout <<  YES n ;     else {       vector<int> a_diff, b_diff, result;       int check_sum = 0;       for (int i = 1; i < n; ++i) {         a_diff.push_back(a[i] - a[i - 1]);         b_diff.push_back(b[i] - b[i - 1]);       }       a_diff.push_back(l - a[n - 1] + a[0]);       b_diff.push_back(l - b[n - 1] + b[0]);       for (int i = 0; i < n; ++i) a_diff.push_back(a_diff[i]);       int i = 0, j = 0, prev_i = 0;       while (i < 2 * n && j < n) {         while (i < 2 * n && b_diff[0] != a_diff[i]) ++i;         j = 0;         prev_i = i;         while (i < 2 * n && j < n && b_diff[j] == a_diff[i]) ++i, ++j;         i = prev_i + 1;         if (j == n) {           cout <<  YES n ;           return 0;         }       }       cout <<  NO n ;     }     return 0;   }   