#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m; cin >> n >> m;
vector<int> a(n), b(m);
int pwm = (1 << m);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
sort(b.begin(), b.end());
unordered_set<int> spwm;
vector<int> sum(pwm, 0);
for (int i = 1; i < pwm; i++) {
int cur = 0;
for (int j = 0; (1 << j) <= i; j++) {
int pw = (1 << j);
if (i & pw) cur += b[j];
}
sum[i] = cur;
spwm.insert(i);
}
bool ans = true;
vector<bool> vis(pwm, 0);
queue<int> que;
que.push(0);
for (int i = 0; i < n; i++) {
auto q = que; que = {};
while (!q.empty()) {
auto cur = q.front(); q.pop();
for (auto j : spwm) {
int next = j | cur;
if (!(j & cur) and sum[j] == a[i] and !vis[next]) {
que.push(next);
vis[next] = true;
spwm.erase(j);
}
}
}
if (que.empty()) {
ans = false;
break;
}
}
cout << (ans ? "YES" : "NO") << '\n';
}