#include <bits/stdc++.h>
using namespace std;
inline long long gi() {
  long long f = 1, sum = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = (sum << 3) + (sum << 1) + ch - '0';
    ch = getchar();
  }
  return f * sum;
}
const long long N = 100010;
long long n, m, d[N], a[N], b[N];
struct node {
  long long day, id;
} exam[N];
bool operator<(const node a, const node b) { return a.day < b.day; }
bool check(long long mid) {
  for (long long i = 1; i <= m; i++) exam[i] = (node){0, i}, b[i] = 0;
  for (long long i = 1; i <= mid; i++)
    if (d[i]) {
      exam[d[i]] = (node){max(i, exam[d[i]].day), d[i]};
      b[d[i]] = 1;
    }
  for (long long i = 1; i <= m; i++)
    if (!b[i]) return false;
  sort(exam + 1, exam + m + 1);
  long long sum = 0;
  for (long long i = 1; i <= m; i++) {
    sum += exam[i].day - exam[i - 1].day - 1;
    long long j = exam[i].id;
    if (sum >= a[j]) {
      sum -= a[j];
      continue;
    }
    return false;
  }
  return true;
}
signed main() {
  n = gi();
  m = gi();
  for (long long i = 1; i <= n; i++) d[i] = gi();
  for (long long i = 1; i <= m; i++) a[i] = gi();
  long long l = 1, r = n, ans = -1;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid)) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
