#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin >> N >> M;
vector<int> a(N + 1), b(M + 1);
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
for (int i = 1; i <= M; i++) {
cin >> b[i];
}
vector<vector<bitset<20>>> comb(1001);
for (int i = 0; i < (1 << M); i++) {
bitset<20> bs(i);
int sum = 0;
for (int j = 0; j < M; j++) {
if (bs[j]) {
sum += b[j + 1];
}
}
if (sum <= 1000) {
comb[sum].push_back(bs);
}
}
vector<vector<bool>> dp(N + 1, vector(1 << M, false));
dp[0][0] = true;
for (int i = 0; i < N; i++) {
for (int j = 0; j < (1 << M); j++) {
if (dp[i][j]) {
for (auto b : comb[i + 1]) {
if ((bitset<20>(j) & b) == bitset<20>(0)) {
dp[i + 1][(bitset<20>(j) | b).to_ulong()] = true;
}
}
}
}
}
bool ok = false;
for (int i = 0; i < (1 << M); i++) {
if (dp[N][i]) {
ok = true;
}
}
if (ok) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}