#include <bits/stdc++.h>
using namespace std;
int N, M, c[105], k[105], sum, Hash[105];
bool b() {
  for (int i = 1; i <= M; i++)
    if (Hash[i] != k[i]) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> c[i];
  for (int i = 1; i <= M; i++) {
    cin >> k[i];
    sum += k[i];
  }
  for (int i = 0; i < sum; i++) Hash[c[i]]++;
  if (b()) {
    cout << "YES";
    return 0;
  }
  for (int i = 1; i + sum - 1 < N; i++) {
    Hash[c[i - 1]]--;
    Hash[c[i + sum - 1]]++;
    if (b()) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
