#include <bits/stdc++.h>
using namespace std;
const int N = 107;
int a[N], b[N], fr[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      for (int k = i; k <= j; k++) {
        fr[a[k]]++;
      }
      bool fl = 0;
      for (int k = 1; k <= m; k++) {
        if (fr[k] != b[k]) {
          fl = 1;
        }
      }
      if (!fl) {
        cout << "YES";
        return 0;
      }
      memset(fr, 0, sizeof(fr));
    }
  }
  cout << "NO";
}
