#include <bits/stdc++.h>
using namespace std;
void A();
void B();
void C();
void D();
void E();
int main() {
  D();
  return 0;
}
int n, m;
int arr[100011], days[100011];
long long cnt = 0;
bool check(int ans) {
  set<int> s;
  while (ans > 0 && arr[ans] == 0) ans--;
  long long free = ans;
  for (int i = ans; i >= 1 && free > 0; i--) {
    if (arr[i] != 0) {
      if (s.find(arr[i]) == s.end()) {
        free--;
        s.insert(arr[i]);
        free -= days[arr[i]];
      }
    }
  }
  return free >= 0 && (int)s.size() == m;
}
int solve() {
  int l = 1, r = n, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  return ans;
}
void D() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &days[i]), cnt += days[i];
  cnt += m;
  printf("%d\n", solve());
}
void C() {
  long long b, d, s;
  cin >> b >> d >> s;
  long long mn = min(b, min(d, s));
  b -= mn, d -= mn, s -= mn;
  if (b == 0) {
    mn = min(d, s);
    printf("%I64d\n", max(0LL, mn + (max(d, s) - mn - 1) * 2));
  } else if (d == 0) {
    mn = min(b, s);
    printf("%I64d\n", max(0LL, mn + (max(b, s) - mn - 1) * 2));
  } else {
    b--, d--;
    mn = min(b, d);
    printf("%I64d\n", max(0LL, mn + max(0LL, (max(b, d) - mn - 1) * 2) + 1));
  }
}
