#include <bits/stdc++.h>
using namespace std;
int val[110], cnt[110], tmp[110], n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 1; i <= k; i++) scanf("%d", &cnt[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      memset(tmp, 0, sizeof(tmp));
      for (int u = i; u <= j; u++) tmp[val[u]]++;
      bool flag = true;
      for (int u = 1; u <= k; u++)
        if (tmp[u] != cnt[u]) flag = false;
      if (flag) {
        puts("YES");
        return 0;
      }
    }
  }
  puts("NO");
  return 0;
}
