#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[101], b[101], c[101];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  int j = 0, i = 0;
  while (j < n) {
    int cnt = 0;
    c[a[j]]++;
    int ok = 1;
    for (int i = 1; i <= m; i++) {
      if (c[i] != b[i]) {
        ok = 0;
      }
      if (c[i] > b[i]) {
        cnt++;
      }
    }
    if (ok) {
      cout << "YES";
      return 0;
    }
    while (cnt > 0 && i <= j) {
      c[a[i]]--;
      if (c[a[i]] == b[a[i]]) {
        cnt--;
      }
      i++;
    }
    j++;
  }
  cout << "NO";
}
