#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<int>people,money;
vector<pair<int,int>>dp;
vector<int>vis;
int n,m;
void printByte(int bit){
for(int i = m;i >= 0;i--){
cout << (((bit & (1 << i)) > 0) ? 1 : 0);
}
cout << '\n';
}
void recursive(int bit){
if(vis[bit]) return;
vis[bit] = 1;
dp[bit] = {-1,0};
for(int i = 0;i < m;i++){
if((1 << i) & bit){
int nbit = bit xor (1 << i);
auto npair = dp[nbit];
if(npair.first == -1) continue;
if(npair.first == n){
dp[bit] = {n,0};
return;
}
if(npair.first < n && npair.second - money[i] >= 0){
npair.second -= money[i];
if(npair.second == 0){
npair.first++;
if(npair.first < n){
npair.second = people[npair.first];
}
}
dp[bit] = max(dp[bit],npair);
}
}
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
people = vector<int>(n);
money = vector<int>(m);
dp = vector<pair<int,int>>((1 << m) + 1);
vis = vector<int>((1 << m) + 1);
for(int i = 0;i < n;i++) cin >> people[i];
for(int i = 0;i < m;i++) cin >> money[i];
dp[0] = {0,people[0]};
for(int i = 1;i < (1 << m);i++){
recursive(i);
if(dp[i].first == n){
cout << "YES";
return 0;
}
}
cout << "NO";
return 0;
}