#include <bits/stdc++.h>
using namespace std;
const int N = 103;
int cnt[N], req[N], tl[N], a[N], sum;
set<int> wg;
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = int(1); i <= int(n); i++) cin >> a[i];
  for (int i = int(1); i <= int(m); i++) {
    cin >> req[i];
    sum += req[i];
  }
  if (sum > n)
    cout << "NO"
         << "\n",
        exit(0);
  ;
  for (int i = int(1); i <= int(sum); i++) {
    tl[a[i]]++;
  }
  for (int i = int(1); i <= int(m); i++) {
    if (req[i] != tl[i]) wg.insert(i);
  }
  if (wg.size() == 0)
    cout << "YES"
         << "\n",
        exit(0);
  ;
  for (int i = int(sum + 1); i <= int(n); i++) {
    if (tl[a[i]] == req[a[i]]) wg.insert(a[i]);
    if (tl[a[i - sum] == req[a[i - sum]]]) wg.insert(a[i - sum]);
    tl[a[i]]++;
    tl[a[i - sum]]--;
    if (tl[a[i]] == req[a[i]]) wg.erase(a[i]);
    if (tl[a[i - sum]] == req[a[i - sum]]) wg.erase(a[i - sum]);
    if (wg.size() == 0)
      cout << "YES"
           << "\n",
          exit(0);
    ;
  }
  cout << "NO"
       << "\n";
}
