#include <bits/stdc++.h>
const long double eps = 0.00000001;
const long long MOD = 1e9 + 7;
using namespace std;
int ans;
int cnt[105], sum;
int main() {
  fflush(stdin);
  cout << fixed, cout.precision(18);
  ios_base::sync_with_stdio(false);
  int i, j, n, m;
  cin >> n >> m;
  int a[n], k[m];
  for (i = 0; i < n; ++i) cin >> a[i];
  for (i = 0; i < m; ++i) cin >> k[i], sum += k[i];
  for (i = 0; i < n; ++i) {
    for (j = i; j < min(n, i + sum); ++j) cnt[a[j]]++;
    bool fl = true;
    for (j = 1; j <= m; ++j) {
      if (cnt[j] != k[j - 1]) fl = false;
      cnt[j] = 0;
    }
    if (fl) return cout << "YES", 0;
  }
  cout << "NO";
}
