#include <bits/stdc++.h>
using namespace std;
bool check(long long mid, vector<long long> &d, vector<long long> &prep) {
  long long n = d.size();
  long long m = prep.size() - 1;
  vector<long long> pos(m + 1, -1);
  for (long long i = 0; i <= mid; i++) pos[d[i]] = i;
  for (long long i = 1; i <= m; i++)
    if (pos[i] == -1) return false;
  long long prep_days = 0;
  for (long long i = 0; i <= mid; i++) {
    if (d[i] == 0)
      prep_days++;
    else if (pos[d[i]] == i) {
      if (prep_days < prep[d[i]])
        return false;
      else
        prep_days -= prep[d[i]];
    } else
      prep_days++;
  }
  return true;
}
int32_t main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> d(n);
  for (long long &i : d) cin >> i;
  vector<long long> prep(m + 1);
  for (long long i = 1; i <= m; i++) cin >> prep[i];
  long long l = 0, r = n - 1;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (check(mid, d, prep)) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  if (r == n - 1) {
    if (check(r, d, prep))
      cout << n << "\n";
    else
      cout << -1 << "\n";
  } else
    cout << r + 1 << "\n";
  return 0;
}
