#include <bits/stdc++.h>
using namespace std;
long long d[100004], n, m, a[100003], sum, cnt[100004];
bool done[100003];
bool check(long long mid) {
  memset(done, false, sizeof done);
  memset(cnt, 0, sizeof cnt);
  long long free = 0;
  for (int i = 0; i < mid; i++) {
    cnt[d[i]]++;
    if (d[i] > 0 && cnt[d[i]] > 1) free++;
    free += (d[i] == 0);
  }
  for (int i = mid - 1; i >= 0; i--) {
    cnt[d[i]]--;
    if (cnt[d[i]] > 0 && done[d[i]]) free--;
    if (d[i] == 0) {
      free--;
      continue;
    } else if (!done[d[i]]) {
      if (a[d[i] - 1] > free) return 0;
      done[d[i]] = true;
    }
  }
  for (int i = 1; i <= m; i++)
    if (!done[i]) return 0;
  return free >= 0;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> d[i];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum += m;
  long long l = sum, r = n, res = 1e9;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid)) {
      res = min(res, mid);
      r = mid - 1;
    } else
      l = mid + 1;
  }
  if (res == 1e9)
    cout << -1;
  else
    cout << res;
  return 0;
}
