#include <bits/stdc++.h>
using namespace std;
int n, m, d[100100], a[100100];
bool vis[100100];
bool check(int x) {
  memset(vis, 0, sizeof(vis));
  int sum = x - 1, cnt = 0;
  for (int i = x; i > 0; i--) {
    sum = min(sum, i - 1);
    if (d[i] && !vis[d[i]] && a[d[i]] <= sum) {
      sum -= a[d[i]] + 1;
      vis[d[i]] = 1;
      cnt++;
    }
  }
  if (cnt == m) return true;
  return false;
}
int f() {
  int l = 1, r = n;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  return l > n ? -1 : l;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
    for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
    printf("%d\n", f());
  }
  return 0;
}
