#include <bits/stdc++.h>
using namespace std;
long long i, k, j, jj, l, s, t, a[223556], b[245789], c[223456], cc[223456], n,
    m, r, d, e, f, ff;
vector<long long> p, q, rr;
pair<long long, long long> x[445678];
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < m; i++) {
    cin >> b[i + 1];
    t += b[i + 1];
  }
  for (i = 0; i <= n - t; i++) {
    for (j = 0; j <= m; j++) c[j] = 0;
    for (j = i; j < i + t; j++) {
      c[a[j]]++;
    }
    k = 0;
    for (j = 1; j <= m; j++) {
      if (b[j] != c[j]) k = 1;
    }
    if (k == 0) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
