#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e6 + 2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, m, end, x, y, stat = 1, mx = 0, sum = 0, zeros = 0,
                                    ones = 0;
  cin >> n >> m;
  long long int a[n], b[102], ar[101][101];
  for (long long int i = 1; i < 101; ++i) {
    b[i] = 0;
    ar[0][i] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    b[a[i]]++;
    for (long long int j = 1; j <= m; ++j) {
      if (j - a[i]) {
        ar[i][j] = ar[i - 1][j];
      } else {
        ar[i][j] = ar[i - 1][j] + 1;
      }
    }
  }
  long long int z[101];
  bool flag2 = false;
  for (long long int i = 1; i <= m; ++i) {
    cin >> z[i];
  }
  for (long long int start = 0; start <= n; ++start) {
    for (long long int end = start; end <= n; ++end) {
      bool flag = true;
      for (long long int j = 1; j <= m; ++j) {
        if ((ar[end][j] - ar[start][j]) != z[j]) {
          flag = false;
          break;
        }
      }
      if (flag) {
        flag2 = true;
        break;
      }
    }
  }
  if (flag2) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
