#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
const long long INF = 0x3f3f3f3f;
long long a[maxn];
long long b[maxn];
long long tf[maxn];
long long n, k;
long long check(long long x) {
  memset(tf, 0, sizeof(tf));
  long long time = x - k;
  long long w = 0;
  long long t = 0;
  for (long long i = x; i >= 1; i--) {
    if (a[i] != 0 && tf[a[i]] == 0 && time >= b[a[i]]) {
      t++;
      time = time - b[a[i]];
      tf[a[i]] = 1;
      w += b[a[i]];
    } else {
      if (w > 0)
        w--;
      else
        time--;
    }
  }
  if (t == k) return 1;
  return 0;
}
int32_t main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= k; i++) cin >> b[i];
  if (check(n)) {
    long long l = 1;
    long long r = n;
    while (1) {
      if (l + 1 == r) break;
      long long mid = (l + r) / 2;
      if (check(mid))
        r = mid;
      else
        l = mid;
    }
    cout << r << endl;
  } else
    cout << "-1" << endl;
}
