#include <bits/stdc++.h>
int n, m;
int ns[200];
int ms[200];
int cnt[200];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &ns[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &ms[i]);
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      memset(cnt, 0, sizeof cnt);
      for (int k = i; k <= j; ++k) ++cnt[ns[k]];
      bool flag = 1;
      for (int k = 1; k <= m; ++k)
        if (cnt[k] != ms[k]) flag = 0;
      if (flag) {
        printf("YES\n");
        return 0;
      }
    }
  printf("NO\n");
}
