#include <bits/stdc++.h>
using namespace std;
int a[205], b[205], c[205];
int main() {
  int n, m;
  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]);
  for (int l = 1; l <= n; l++)
    for (int r = l; r <= n; r++) {
      for (int i = 1; i <= m; i++) c[i] = 0;
      for (int i = l; i <= r; i++) c[a[i]]++;
      for (int i = 1; i <= m; i++)
        if (c[i] != b[i]) goto fail;
      puts("YES");
      return 0;
    fail:;
    }
  puts("NO");
  return 0;
}
