#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[100], L[100], n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> A[i], A[i]--;
  for (int i = 0; i < m; ++i) cin >> L[i];
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      vector<int> cnt(m + 1, 0);
      for (int k = i; k < j; ++k) cnt[A[k]]++;
      bool fl = true;
      for (int k = 0; k < m; ++k) fl &= (L[k] == cnt[k]);
      if (fl) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  cout << "NO\n";
}
