#include <bits/stdc++.h>
using namespace std;
long long int expo(long long int base, long long int exponent,
                   long long int mod) {
  long long int ans = 1;
  while (exponent != 0) {
    if ((exponent & 1) == 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    exponent >>= 1;
  }
  return ans % mod;
}
long long int F[10005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int sto[105];
  for (long long int i = 0; i < n; ++i) cin >> sto[i];
  long long int ary[105];
  long long int sum = 0;
  for (long long int i = 1; i < m + 1; ++i) {
    cin >> ary[i];
    sum += ary[i];
  }
  long long int F[105];
  for (long long int i = 0; i < n - sum + 1; ++i) {
    for (long long int j = 0; j < 105; ++j) F[j] = 0;
    for (long long int j = i; j < i + sum; ++j) {
      F[sto[j]]++;
    }
    long long int flag = 0;
    for (long long int j = 1; j < m + 1; ++j) {
      if (F[j] != ary[j]) flag = 1;
    }
    if (flag == 0) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
