#include <bits/stdc++.h>
using namespace std;
const int N = 202;
int n, m;
int arr[N], req[N], curr[N], nw;
int main() {
  int tot = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &req[i]), tot += req[i];
    if (!req[i]) nw++;
  }
  int ans = -1;
  int l = 1, r = 0;
  while (l <= n && r <= n) {
    if (nw == m) {
      return printf("YES"), 0;
    }
    r++;
    curr[arr[r]]++;
    if (curr[arr[r]] > req[arr[r]]) {
      while (arr[l] != arr[r]) {
        if (curr[arr[l]] == req[arr[l]]) nw--;
        curr[arr[l]]--;
        l++;
      }
      curr[arr[l]]--;
      l++;
    } else if (curr[arr[r]] == req[arr[r]]) {
      nw++;
    }
  }
  printf("NO");
  return 0;
}
