#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0;i<(int)(n);i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int,int>;
struct UnionFind {
    vector<int> par, size;
    UnionFind(int x) {
        par.resize(x);
        size.resize(x, 1);
        for(int i = 0; i < x; i++) {
            par[i] = i;
        }
    }
    int find(int x) {
        if (par[x] == x)
            return x;
        return par[x] = find(par[x]);
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int consize(int x) {
        return size[find(x)];
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (size[x] < size[y]) {
            par[x] = y;
            size[y] += size[x];
        }
        else {
            par[y] = x;
            size[x] += size[y];
        }
    }
};
signed main() {
    int n,m;cin >> n >> m;
    // vector<vector<int>> G(n);
    UnionFind uf(n);
    vector<int> a(n),b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    vector<int> v(n);
    rep(i, n) v[i]=b[i]-a[i];
    rep(i, m) {
        int a,b;cin >> a >> b;
        a--;b--;
        uf.unite(a,b);
    }
    map<int,int> mp;
    rep(i, n) {
        mp[uf.find(i)]+=v[i];
    }
    for(auto p:mp) {
        if(p.second) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

// Problem : B - Values
// Contest : AtCoder - AtCoder Regular Contest 106
// URL : https://atcoder.jp/contests/arc106/tasks/arc106_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

int N, M;
int dsu[200005];
long long val1[200005], val2[200005];

int getrt(int n){
	return dsu[n] = (dsu[n] == n ? n : getrt(dsu[n]));
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N >> M;
	for(int i= 1; i<=N; i++){
		dsu[i] = i;
		cin >> val1[i];
	}
	for(int i = 1; i<=N; i++){
		cin >> val2[i];
	}
	while(M--){
		int a, b;
		cin >> a >> b;
		if(getrt(a) != getrt(b)){
			val1[getrt(a)] += val1[getrt(b)];
			val2[getrt(a)] += val2[getrt(b)];
			dsu[getrt(b)] = getrt(a);
		}
	}
	for(int i = 1; i<=N; i++){
		if(getrt(i) == i){
			if(val1[i] != val2[i]){
				cout << "No\n";
				return 0;
			}
		}
	}
	cout << "Yes";
}