#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int cnt[105] = {};
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    cin >> cnt[i];
    sum += cnt[i];
  }
  for (int i = 0, j = 0; i < n;) {
    if (sum == 0) {
      cout << "YES\n";
      return 0;
    }
    if (j < n && cnt[arr[j]] > 0) {
      cnt[arr[j++]]--;
      sum--;
    } else {
      cnt[arr[i++]]++;
      sum++;
    }
  }
  cout << "NO\n";
}
