#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9, N = 101;
int n, m, q, tot, a[N], b[N];
int vis[N];
bool solve(int pos) {
  memset(vis, 0, sizeof(vis));
  for (int i = pos; i < pos + tot; i++) vis[a[i]]++;
  for (int i = 1; i < m + 1; i++)
    if (vis[i] != b[i]) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < m + 1; i++) {
    cin >> b[i];
    tot += b[i];
  }
  for (int i = 0; i < n - tot + 1; i++)
    if (solve(i)) return !(cout << "YES" << endl);
  cout << "NO" << endl;
}
