#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>

using namespace std;

typedef int in;
#define int long long
const long double EPS=1e-9;
const int MOD=1e9+7;
const int N=1e6;

int n,m,arr1[200005],arr2[200005];
struct node{
	int x,a,b;
};
vector<node> adj[200005];
bool vis[200005];
int sm1,sm2;

void dfs(node nd){
	vis[nd.x] = 1;
	sm1 += nd.a;
	sm2 += nd.b;
	//cout << nd.x << " " << nd.a << " " << nd.b << endl;
	for(int i = 0 ; i < adj[nd.x].size() ; i ++){
		node f = adj[nd.x][i];
		if(vis[f.x]){
			continue;
		}
		dfs(f);
	}
}

in main(){
	cin >> n >> m;
	for(int i = 0 ; i < n ; i ++){
		cin >> arr1[i];
	}
	for(int i = 0 ; i < n ; i ++){
		cin >> arr2[i];
	}
	for(int i = 0 ; i < m ; i ++){
		int x,y;
		cin >> x >> y;
		node dummy;
		dummy.x = y;
		dummy.a = arr1[y - 1];
		dummy.b = arr2[y - 1];
		adj[x].push_back(dummy);
		dummy.x = x;
		dummy.a = arr1[x - 1];
		dummy.b = arr2[x - 1];
		adj[y].push_back(dummy);
	}
	for(int i = 1 ; i <= n ; i ++){
		if(!vis[i]){
			node dummy;
			dummy.x = i;
			dummy.a = arr1[i - 1];
			dummy.b = arr2[i - 1];
			sm1 = 0;
			sm2 = 0;
			dfs(dummy);
			//cout << sm1 << " " << sm2 << endl;
			if(sm1 != sm2){
				cout << "No\n";
				return 0;
			}
		}
	}
	cout << "Yes\n";
	return 0;
}

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<time.h>
#include<list>
#include<iomanip>
#include<string>
#include<sstream>
#include<string.h>
#include<queue>
#include<stack>
#include <numeric>
#include<ctype.h>
#define h 1010
#define infi 1000000000000000
#define lli unsigned long long int
#define pb push_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
using namespace std;
int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n,m, x,y, i, sum=0,sum2=0,j, flag=0;
	cin>>n>>m;
	vector<lli>a(n+1),b(n+1);
	vector< vector<lli> >g(n+1);
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=1;i<=n;i++) cin>>b[i];
	for(i=0;i<m;i++) 
	{
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	} 
	vector<bool>vis(n+1,false);
	queue<lli>q;
	for(j=1;j<=n;j++) {
		sum=0;sum2=0;
		if(vis[j]==false) {
	q.push(j);
	vis[j]=true;;
	while(!q.empty()) 
	{
		x=q.front();
		q.pop();
		if(a[x]<=b[x]) sum+=(b[x]-a[x]);
		else sum2+=(a[x]-b[x]);
		for(i=0;i<g[x].size();i++) 
		{
			if(vis[g[x][i]]==false) 
			{
				vis[g[x][i]]=true;
				q.push(g[x][i]);
			} 
		} 
	}
	} 
	if(sum==sum2)continue;
	else{flag=1;break;} 
	} 
	if(flag)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
} 
