#include <bits/stdc++.h>
using namespace std;
int n, m, a[150], b[150], c[150];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= n; i++) {
    memset(c, 0, sizeof(c));
    for (int j = i; j <= n; j++) {
      c[a[j]]++;
      bool p = true;
      for (int k = 1; k <= m; k++) {
        if (c[k] != b[k]) {
          p = false;
          break;
        }
      }
      if (p) {
        return cout << "YES", 0;
      }
    }
  }
  cout << "NO";
}
