#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repi(i,x,y) for(int i = x; i >= y; --i)
#define fi first
#define se second
#define ci(x) int x; cin >> x
#define cii(x,y) int x, y; cin >> x >> y
#define ciii(x,y,z) int x,y,z; cin >> x >> y >> z
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
//#define int long long
typedef long long ll;
const int N = 5e5 + 5;
const int mod = 1e9 + 7;
const int mod1 = 1e9 + 9;
const int pi = 23;
const ll inf = 1e18 + 5;
void read_file(){
freopen("text.inp", "r", stdin);
// freopen("SEARCHING.INP" , "r", stdin);
// freopen("SEARCHING.OUT", "w", stdout);
}
/*
dp[bit][i] is the subset of M so that you can pay for first i members
enumerate subset of subset in 3^n for sub 1,2,3
*/
int n, m;
int a[N], b[N];
int dp[(1<<20) + 5][25];
void inp(){
cin >> n >> m;
rep(i,1,n) cin >> a[i];
rep(i,0,m-1) cin >> b[i];
}
int sum[(1<<20) + 5];
void process(){
rep(i,0,(1<<m)-1)
for(int j = 0; j < m; ++j)
if((i>>j)&1)
sum[i] += b[j];
if(n==1){
bool ok = 0;
rep(i,0,(1<<m)-1)
if(sum[i]==a[1]){
ok = 1;
break;
}
if(ok) cout << "YES";
else cout << "NO";
return;
}
dp[0][0] = 1;
rep(i,1,(1<<m)-1){
for(int t = i; t; t = (t-1)&i){
rep(j,1,n){
int s = sum[t];
if(s==a[j] && dp[i^t][j-1]){
if(i==63)
int h = 0;
dp[i][j] = 1;
}
}
}
}
bool ok = 0;
rep(i,0,(1<<m)-1)
if(dp[i][n]){
ok = 1;
break;
}
if(ok) cout << "YES";
else cout << "NO";
}
int main()
{
// read_file();
ios_base::sync_with_stdio(0);
cin.tie(0);
inp();
process();
return 0;
}