#include <stdio.h>
inline int read() {
    int b = getchar(), c = 0;
    int m = b == 45;
    if (m) b = getchar();
    while (b > 47) {
        c = c * 10 + b - 48;
        b = getchar();
    }
    return m ? - c : c;
}
int p[200001];
int main() {
    int a[400002];
    int n = read(), m = read();
    long s = 0;
    for (int i = 1; i <= n + n; i++) a[i] = read();
    for (int i = 0; i < m + m; i++) p[read()] = 1;
    p[1] = 1;
    for (int i = 1; i < 200001; i++) {
        if (p[i]) s += a[i] - a[i + n];
    }
    puts(s ? "No" : "Yes");
}
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
vector<long long int> diff;
vector<bool> seen;
long long int sum;

void dfs(const Graph &G,int v){
  sum += diff[v];
  seen[v] = true;
  for(auto next_v:G[v]){
    if(seen[next_v]) continue;
    else dfs(G,next_v);
  }
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<long long int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  vector<long long int> B(N);
  for(int i=0;i<N;i++) cin >> B[i];
  diff.assign(N,0);
  for(int i=0;i<N;i++) diff[i] = A[i]-B[i];
  Graph G(N,vector<int>(0));
  seen.assign(N,false);
  for(int i=0;i<M;i++){
    int c,d;
    cin >> c >> d;
    c--;
    d--;
    G[c].push_back(d);
    G[d].push_back(c);
  }
  bool flag = true;
  for(int i=0;i<N;i++){
    if(seen[i]) continue;
    else{
      sum=0;
      dfs(G,i);
      if(sum != 0){
        flag = false;
        break;
      }
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}