#include <bits/stdc++.h>
using namespace std;
int a[30], b[30];
int n,m;
bool fnd(int idx, int vst) {
if (idx == n) return true;
bool ok=0;
for (int i=0; i<(1<<m); i++) {
if (i&vst) continue;
int sm=0;
for (int j=0; j<m; j++) {
if (i & (1<<j)) {
sm+=b[j];
}
}
if (sm == a[idx]) {
ok = ok || fnd(idx+1, (vst|i));
}
}
return ok;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin>> n>> m;
for (int i=0; i<n; i++) cin>> a[i];
for (int i=0; i<m; i++) cin>> b[i];
if (fnd(0, 0)) cout<< "YES";
else cout<< "NO";
}