#include <bits/stdc++.h>
using namespace std;
namespace task {
int n, m, c;
int a[101][101];
int k[101];
bool check(int i, int j) {
  for (int t = 0; t <= 100; ++t) {
    if (a[j][t] - a[i - 1][t] != k[t]) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 100; ++j) {
      a[i][j] = a[i - 1][j];
    }
    cin >> c;
    ++a[i][c];
  }
  for (int i = 1; i <= m; ++i) {
    cin >> k[i];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j) {
      if (check(i, j)) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  cout << "NO\n";
  return 0;
}
}  // namespace task
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
  return task::main();
}
