#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e5 + 13;
long long n, m;
long long d[MAX];
pair<long long, long long> a[MAX];
map<long long, vector<long long>> mp;
bool condition(long long x) {
  mp.clear();
  for (int i = 1; i <= x; i++) {
    if (!d[i]) continue;
    mp[d[i]].push_back(i);
  }
  long long s = 0;
  for (int i = 1; i <= m; i++) {
    s += a[i].first;
  }
  if (x < s + m) return false;
  s = 0;
  for (int i = 1; i <= m; i++) {
    s += a[i].first;
    if (!mp[a[i].second].size()) return false;
    if (mp[a[i].second][mp[a[i].second].size() - 1] < (a[i].first + 1))
      return false;
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> d[i];
  }
  for (long long i = 1; i <= m; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + m + 1);
  long long l = 0, r = n + 1;
  while (r - l > 1) {
    long long m = (r + l) / 2;
    if (condition(m))
      r = m;
    else
      l = m;
  }
  if (n >= r) {
    cout << r;
  } else {
    cout << -1;
  }
  return 0;
}
