#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, arr[105], col[105];
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) {
      cin >> arr[i];
    }
    for (int i = 1; i <= m; i++) {
      cin >> col[i];
    }
    int ans = 0;
    for (int i = 1; i <= n && !ans; i++) {
      int mark[105];
      memset(mark, 0, sizeof(mark));
      for (int k = i; k <= n; k++) {
        mark[arr[k]]++;
        int ck = 1;
        for (int p = 1; p <= m; p++) {
          if (mark[p] != col[p]) {
            ck = 0;
            break;
          }
        }
        if (ck) {
          ans = 1;
          break;
        }
      }
    }
    if (ans) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
  return 0;
}
