#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int an, sum = 0, flg = 1, a[n + 1], ar[m + 1], temp[m + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &ar[i]);
    sum += ar[i];
  }
  sum = sum - 1;
  for (int i = 1; i + sum <= n; i++) {
    for (int j = 1; j <= m; j++) temp[j] = ar[j];
    flg = 1;
    for (int j = i; j <= i + sum; j++) {
      temp[a[j]]--;
      if (temp[a[j]] < 0) {
        flg = 0;
        break;
      }
    }
    if (flg) {
      for (int j = 1; j <= m; j++) {
        if (temp[j] != 0) {
          flg = 0;
        }
      }
    }
    if (flg) break;
  }
  if (flg)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
