#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 1e5 + 100;
int d[MAXN], a[MAXN], vis[MAXN], n, m;
bool can(int x) {
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i < x + 1; i++)
    if (d[i]) vis[d[i]] = i;
  vector<pair<int, int> > aa;
  for (int i = 1; i < n + 1; i++) {
    if (!vis[i]) return 0;
    aa.push_back({vis[i], a[i]});
  }
  sort(aa.begin(), aa.end());
  int res = 0;
  for (auto it : aa) {
    res += it.second;
    if (res > it.first) return 0;
  }
  return 1;
}
int main() {
  int t = 1;
  while (t--) {
    cin >> m >> n;
    for (int i = 1; i < m + 1; i++) cin >> d[i];
    for (int i = 1; i < n + 1; i++) {
      cin >> a[i];
      a[i]++;
    }
    int l = n, r = m + 1, md = (l + r) >> 1;
    while (l < r) {
      if (can(md))
        r = md;
      else
        l = md + 1;
      md = (l + r) >> 1;
    }
    if (md <= m)
      cout << md << endl;
    else
      cout << "-1\n";
  }
  return 0;
}
