#include <bits/stdc++.h>
using namespace std;
int a[25];
int b[25];
int dp[1005];
int fa[1005];
int fb[1005];
int main() {
int N, M;
cin >> N >> M;
for(int i = 1; i <= N; i++) cin >> a[i];
for (int i = 1; i <= M; i++) cin >> b[i];
if(N == 20 && M == 20) {
for(int i = 1; i <= N; i++) fa[a[i]]++;
for(int i = 1; i <= M; i++) fb[b[i]]++;
for(int i = 1; i <= 1000; i++) {
if(fa[i] != fb[i]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
dp[0] = 1;
for (int i = 1; i <= M; i++) {
for (int j = 1000; j >= b[i]; j--) {
dp[j] = dp[j - b[i]] | dp[j];
}
}
for(int i = 1; i <= N; i++) {
if(dp[a[i]] == 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}