#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

class UnionFind {
public:
    vector<int> par;
    int num;

    UnionFind(int n) : par(n, -1), num(n) {};

    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    int size(int x) {
        return -par[root(x)];
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        num--;
        return true;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    int a[n], b[n];
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) cin >> b[i];
    UnionFind uf(n);
    rep(i, 0, m) {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        if (!uf.same(c, d)) uf.unite(c, d);
    }
    vector<ll> x(n, 0), y(n, 0);
    rep(i, 0, n) {
        x[uf.root(i)] += a[i];
        y[uf.root(i)] += b[i];
    }
    if (x == y) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

#include <bits/stdc++.h>

#define rep(i, a, b) for (int i = a, i##end = b; i <= i##end; ++i)
#define per(i, a, b) for (int i = a, i##end = b; i >= i##end; --i)
#define rep0(i, a) for (int i = 0, i##end = a; i < i##end; ++i)
#define per0(i, a) for (int i = (int)a-1; ~i; --i)
#define chkmax(a, b) a = std::max(a, b)
#define chkmin(a, b) a = std::min(a, b)
#define x first
#define y second
#define pb push_back
#define mp std::make_pair
#define enter putchar('\n')

typedef long long ll;

int read() {
	int w = 0, f = 1; char c;
	while (!isdigit(c = getchar())) c == '-' && (f = -1);
	while (isdigit(c)) w = w*10+(c^48), c = getchar();
	return w * f;
}

int a[4];

int main() {
	rep0(i, 4) a[i] = read();
	std::sort(a, a+4);
	if (a[0] + a[1] + a[2] == a[3] || a[0] + a[2] == a[1] + a[3] || a[0] + a[3] == a[1] + a[2]) printf("Yes");
	else printf("No");
	return 0;
}