#include <bits/stdc++.h>
using namespace std;
int a[120001], b[120001], c[120001], p[120001], n, m, i, k, l, r, mid, sum, ans;
bool pole[120001], x;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= m; i++) cin >> b[i];
  l = 1;
  r = n;
  while (l <= r) {
    mid = (l + r) / 2;
    for (i = 1; i <= m; i++) p[i] = 0;
    for (i = 1; i <= mid; i++)
      if (a[i] != 0) p[a[i]] = i;
    x = true;
    for (i = 1; i <= m; i++)
      if (p[i] == 0) x = false;
    if (!x) {
      l = mid + 1;
      continue;
    }
    for (i = 1; i <= n; i++) pole[i] = false;
    for (i = 1; i <= m; i++) pole[p[i]] = true;
    k = 0;
    for (i = 1; i <= n; i++)
      if (pole[i]) {
        k++;
        c[k] = i;
      }
    sum = 0;
    for (i = 1; i <= k; i++) {
      sum += c[i] - c[i - 1] - 1;
      if (sum - b[a[c[i]]] < 0) {
        x = false;
        break;
      }
      sum -= b[a[c[i]]];
    }
    if (x) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  if (ans != 0)
    cout << ans;
  else
    cout << "-1";
  cout << '\n';
  return 0;
}
