#include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; const ll INF = 1e+15; typedef pair P; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n; ll l; cin >> n >> l; vector d(n); for(int i = 0; i < n; i++) cin >> d[i]; vector b(2*n); for(int i = 0; i < 2*n; i++) cin >> b[i]; ll b_sum = accumulate(b.begin(), b.end(), 0ll); for(int i = 0; i < n; i++){ if((b[i]+b[i+n])*n != b_sum){ cout << "No" << endl; return 0; } } ll D = b_sum/(l*n); vector x(n-1); vector y(n-1); for(int i = 0; i < n-1; i++){ if((b[i]-b[i+1])%(d[i+1]-d[i]) != 0){ cout << "No" << endl; return 0; } x[i] = (b[i]-b[i+1])/(d[i+1]-d[i]); if(D-x[i] < 0 || (D-x[i])%2 != 0){ cout << "No" << endl; return 0; } y[i] = (D-x[i])/2; } vector dd(2*n); dd[0] = 0; for(int i = 0; i < n-1; i++){ dd[i+1] = dd[i]+max(0, y[i]-y[i+1]); } for(int i = 0; i < n-1; i++){ dd[i+n] = dd[i]+y[i]; if(dd[i+n] < dd[i+n-1]){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; }