#include <bits/stdc++.h>
int n, m;
int a[100005], b[100005], flag[100005];
int Jud(int k) {
  int i, sum;
  sum = 0;
  memset(flag, 0, sizeof(flag));
  for (i = k; i >= 1; i--) {
    if (a[i] != 0 && flag[a[i]] == 0) {
      flag[a[i]] = 1;
      sum += b[a[i]];
    } else if (sum != 0)
      sum--;
  }
  for (i = 1; i <= m; i++) {
    if (flag[i] == 0) return 0;
  }
  if (sum != 0) return 0;
  return 1;
}
int main() {
  int i, l, r, mid;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= m; i++) scanf("%d", &b[i]);
  l = 1, r = n;
  while (l < r) {
    mid = (l + r) / 2;
    if (Jud(mid) == 0)
      l = mid + 1;
    else
      r = mid;
  }
  if (Jud(l) == 1)
    printf("%d\n", l);
  else if (Jud(r) == 1)
    printf("%d\n", r);
  else
    printf("-1\n");
  return 0;
}
