#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[105], b[105], b1[105];
  int n, m, sum = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    sum += b[i];
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    memset(b1, 0, sizeof(b1));
    for (int j = i; i + sum - 1 <= n && j <= i + sum - 1; j++) {
      b1[a[j]]++;
    }
    for (int j = 1; j <= m; j++) {
      if (b1[j] != b[j])
        break;
      else if (j == m) {
        flag = 1;
        goto L;
      }
    }
  }
L:
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
}
