#include <bits/stdc++.h>
using namespace std;
int n, m, x, V[1005], len, A[1005], F[1005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> V[i];
  for (int i = 1; i <= m; i++) {
    cin >> A[i];
    len += A[i];
  }
  for (int i = 1; i + len - 1 <= n; i++) {
    for (int j = 1; j <= m; j++) F[j] = A[j];
    for (int j = i; j <= i + len - 1; j++) F[V[j]]--;
    int ok = 1;
    for (int j = 1; j <= m; j++)
      if (F[j] != 0) ok = 0;
    if (ok) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
