#include <bits/stdc++.h>
using namespace std;
int n, m, l, ans;
int a[101000], d[101000];
bool p[101000];
bool check(int x) {
  for (int i = 0; i <= m; i++) p[i] = false;
  int t = 0;
  int dn = 0;
  for (int i = x; i > 0; i--)
    if (p[d[i]])
      dn--;
    else if (d[i] > 0) {
      t++;
      dn += a[d[i]];
      p[d[i]] = true;
      p[0] = true;
    }
  return t == m && dn <= 0;
}
int bs(int l, int r) {
  int x = (l + r) / 2;
  if (l >= r) return l;
  if (check(x))
    return bs(l, x);
  else
    return bs(x + 1, r);
}
int main() {
  ios::sync_with_stdio(false);
  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]);
    l += a[i];
  }
  l += m;
  ans = bs(l, n);
  if (ans > n) ans = -1;
  printf("%d", ans);
  return 0;
}
