#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n + 2];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int c = 0;
  int a[m + 1];
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    c += a[i];
  }
  bool f = false;
  for (int i = 1; i <= n - c + 1; i++) {
    int ab[m + 1];
    fill(ab, ab + m + 1, 0);
    for (int j = i; j < i + c; j++) {
      ab[arr[j]]++;
    }
    f = true;
    for (int k = 1; k <= m; k++)
      if (a[k] != ab[k]) f = false;
    if (f) break;
  }
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
