#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[105];
int c[105];
int cl[105];
int d[105][105];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cl[a[i]]++;
    for (int j = i; j <= n; j++) d[j][a[i]] = cl[a[i]];
  }
  bool flag = false;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int dis = 0;
      for (int k = 1; k <= m; k++) {
        if (d[j][k] - d[i - 1][k] == c[k]) {
          dis++;
        }
      }
      if (dis == m) flag = true;
      if (flag) break;
    }
    if (flag) break;
  }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
