#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int inp[105];
  memset(inp, 0, sizeof inp);
  for (int a = 0; a < n; a++) {
    int v;
    scanf("%d", &v);
    inp[a] = v;
  }
  bool valid = true;
  int arr[105], flag[105];
  for (int a = 1; a <= m; a++) {
    int v;
    scanf("%d", &v);
    arr[a] = v;
  }
  for (int a = 0; a < n; a++) {
    memset(flag, 0, sizeof flag);
    for (int b = a; b < n; b++) {
      flag[inp[b]]++;
      bool val = true;
      for (int c = 1; c <= m; c++) {
        if (flag[c] != arr[c]) {
          val = false;
          break;
        }
      }
      if (val) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
}
