#include <bits/stdc++.h>
using namespace std;
void JIZZ(string output = "") {
  cout << output;
  exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-13;
const long long mod = 1e9 + 7;
int a[111], c[111], q[111];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> q[i];
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j) {
      memset((c), (0), sizeof(c));
      for (int k = i; k <= j; ++k) ++c[a[k]];
      bool ok = 1;
      for (int k = 1; k <= m; ++k)
        if (c[k] != q[k]) ok = 0;
      if (ok) {
        cout << "YES" << endl;
        exit(0);
      }
    }
  }
  cout << "NO" << endl;
}
