#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
int n, m;
int a[maxn];
int b[maxn];
struct node {
  int Time;
  int sub;
} c[maxn];
int cmp(node x, node y) { return x.Time < y.Time; }
bool calc(int x) {
  int lefttime = 0;
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= x; i++)
    if (a[i]) {
      c[a[i]].sub = a[i];
      c[a[i]].Time = i;
    }
  for (int i = 1; i <= m; i++)
    if (!c[i].Time) return false;
  sort(c + 1, c + m + 1, cmp);
  for (int i = 1; i <= m; i++) {
    lefttime += c[i].Time - c[i - 1].Time - 1;
    if (lefttime < b[c[i].sub]) return false;
    lefttime -= b[c[i].sub];
  }
  return true;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
    int L, R, mid, ans = -1;
    if (!calc(n)) {
      printf("%d\n", ans);
      continue;
    }
    L = 1;
    R = n - 1;
    ans = n;
    while (L <= R) {
      mid = (L + R) >> 1;
      if (calc(mid)) {
        ans = mid;
        R = mid - 1;
      } else
        L = mid + 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
