#include <bits/stdc++.h>
using namespace std;
int n, m;
int ls[110], kind[110], cnt[110];
bool cmp() {
  for (int i = 1; i <= m; i++)
    if (kind[i] != cnt[i]) return false;
  return true;
}
int main() {
  bool flag = false;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ls[i];
  for (int i = 1; i <= m; i++) cin >> kind[i];
  for (int i = 0; i < n; i++) {
    memset(cnt, 0, sizeof cnt);
    cnt[ls[i]]++;
    if (cmp()) {
      flag = true;
      break;
    }
    for (int j = i + 1; j < n; j++) {
      cnt[ls[j]]++;
      if (cmp()) {
        flag = true;
        break;
      }
    }
    if (flag) break;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
