#include <bits/stdc++.h>
using namespace std;
int a[200007], x[200007], cnt[200007] = {0};
int n, m, tot = 0;
inline int pd() {
  for (int i = 1; i <= m; ++i)
    if (cnt[i] ^ x[i]) return 0;
  return 1;
}
inline long long int read() {
  long long int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void writ(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) writ(x / 10);
  putchar(x % 10 + '0');
}
inline void write(int x) {
  writ(x);
  putchar(' ');
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= m; ++i) x[i] = read(), tot += x[i];
  for (int i = 1; i <= tot; ++i) ++cnt[a[i]];
  if (pd()) {
    puts("YES");
    return 0;
  }
  for (int i = tot + 1; i <= n; ++i) {
    --cnt[a[i - tot]], ++cnt[a[i]];
    if (pd()) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
