#include <bits/stdc++.h>
using namespace std;
int a[200], mk[200], cnt[200][200];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    cnt[i][a[i]]++;
  }
  for (int i = 1; i <= m; ++i) cin >> mk[i];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cnt[i][j] += cnt[i - 1][j];
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      bool can = 1;
      for (int k = 1; k <= m; ++k)
        if (mk[k] != cnt[j][k] - cnt[i - 1][k]) can = 0;
      if (can) return printf("YES\n"), 0;
    }
  printf("NO\n");
  return 0;
}
