#include <bits/stdc++.h>
using namespace std;
int arr[100];
int desired[101];
deque<int> dq;
bool is_all_element_zero(int arr[], int n) {
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    if (arr[i] != 0) {
      ok = false;
      break;
    }
  }
  return ok;
}
int main() {
  int n, m;
  int i, j;
  int tmp;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int cnt_saber = 0;
  for (j = 1; j <= m; j++) {
    cin >> desired[j];
    cnt_saber += desired[j];
  }
  for (i = 0; i < cnt_saber; i++) {
    dq.push_back(arr[i]);
    desired[arr[i]]--;
  }
  bool ok = false;
  for (; i < n; i++) {
    if (is_all_element_zero(desired, m)) {
      ok = true;
      break;
    }
    desired[dq.front()]++;
    dq.pop_front();
    desired[arr[i]]--;
    dq.push_back(arr[i]);
  }
  if (is_all_element_zero(desired, m)) ok = true;
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}
