#include <bits/stdc++.h>
int arr[250];
int ans[250];
int main() {
  int num;
  int clr;
  scanf("%d%d", &num, &clr);
  for (int i = 1; i <= num; ++i) {
    scanf("%d", &arr[i]);
  }
  int res = 0;
  for (int i = 1; i <= clr; ++i) {
    scanf("%d", &ans[i]);
    res += ans[i];
  }
  std::queue<int> que;
  for (int i = 1; i <= num; ++i) {
    --ans[arr[i]];
    --res;
    que.push(arr[i]);
    while (ans[arr[i]] < 0) {
      int now = que.front();
      que.pop();
      ++ans[now];
      ++res;
    }
    if (res == 0) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
