// cd /mnt/c/users/murad/onedrive/dokumente
/// https://open.spotify.com/intl-tr/track/13XGeumHl6payK5U9fI0R7?si=c27aa63e897a4bcb
/*
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
??????????????????????????
'*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define int long long
#define YES cout << "YES" << '\n';
#define NO cout << "NO" << '\n';
#define Yes cout << "Yes" << '\n';
#define No cout << "No" << '\n';
#define no cout << "no" << '\n';
#define yes cout << "yes" << '\n';
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr);
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define pf push_front
#define M_PI 3.14159265358979323846
#define vi vector<long long>
#define pii pair<long long, long long>
#define vii vector<pair<long long, long long>>
#define vvi vector<vector<long long>>
#define FOR0(i, n) for (int i = 0; i < n; ++i)
#define FOR1(i, n) for (int i = 1; i <= n; ++i)
const long long kurdistan = 0;
const long long MOD = 998244353;
const long long INF = 1e18;
const long long LINF = 4e18;
const long long LOG = 1e8;
const long long MAXN = 50000;
const long long MAXM = 200000 + 5;
const long long sz = 200000 + 9;
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
void print(const vector<T> &v)
{
for (auto &x : v)
{
cout << x << ' ';
}
cout << '\n';
}
template <typename T>
void input(vector<T> &v)
{
for (auto &x : v)
{
cin >> x;
}
}
int ebob(int a, int b)
{
int g = std::gcd(a, b);
return g;
}
int ekob(int a, int b)
{
int g = std::gcd(a, b);
return (a / g) * b;
}
using namespace __gnu_pbds;
template <typename T>
using indexed_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
template <typename T>
using indexed_multiset = tree<
pair<T, int>,
null_type,
less<pair<T, int>>,
rb_tree_tag,
tree_order_statistics_node_update>;
///--------------------TEMPLATE END-------------------------------------
int n, m;
vi a(30);
vi b(30);
vector<vii> ver;
unordered_map<int, bool> dp[30];
bool f(int id, int elon)
{
if (id == n)
{
return true;
}
int key = elon;
if (dp[id].count(key))
{
return dp[id][key];
}
for (auto [i, j] : ver[id])
{
if (!(elon & (1LL << i)) && !(elon & (1LL << j)))
{
if (f(id + 1, elon | (1LL << i) | (1LL << j)))
{
return dp[id][key] = true;
}
}
}
return dp[id][key] = false;
}
void _()
{
cin >> n >> m;
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
for (int i = 0; i < m; ++i)
{
cin >> b[i];
}
ver.assign(n, {});
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
for (int k = j + 1; k < m; ++k)
{
if (b[k] + b[j] == a[i])
{
ver[i].pb({j, k});
}
}
}
if (ver[i].empty())
{
NO return;
}
}
if (f(0, 0))
{
YES return;
}
NO
}
//niga
signed main()
{
fastio int t = 1;
// cin >> t;
while (t--)
{
_();
}
}