#include <bits/stdc++.h>
using namespace std;
int n, m, a[110], b[110], num[110], sum, p;
void pan() {
  for (int j = 1; j <= m; j++)
    if (num[j] != b[j]) return;
  p = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int j = 1; j <= m; j++) scanf("%d", &b[j]), sum += b[j];
  for (int i = 1; i <= n - sum + 1; i++) {
    memset(num, 0, sizeof(num));
    for (int j = i; j <= i + sum - 1; j++) num[a[j]]++;
    pan();
  }
  if (p)
    printf("YES");
  else
    printf("NO");
}
