#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nn endl
#define pb push_back
int n, m;
vector<int> b(25), a(25);
bool rec(int id, int sum)
{
if(sum == b[id]) return true;
if(sum > b[id]) return false;
for(int i = 1; i <= m; i++)
{
if(a[i] == -1) continue;
int x = a[i];
a[i] = -1;
if(rec(id, sum + x))
{
return true;
}
a[i] = x;
}
return false;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= n; i++)
{
cin >> b[i];
}
for(int i = 1; i <= m; i++)
{
cin >> a[i];
}
bool ok = true;
for(int i = 1; i <= n; i++)
{
if(!rec(i, 0))
{
ok = false;
break;
}
}
if(ok) cout << "YES" << nn;
else cout << "NO" << nn;
}