#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return SQR(POW(B, P / 2));
}
template <typename T>
inline T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T BMOD(T p, T e, T m) {
  T ret = 1;
  while (e) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
    e >>= 1;
  }
  return (T)ret;
}
int n, m, arr[300005], mp[300005], cs[100005], ex[300005];
int ok(int x) {
  if (x == 0) return 0;
  if (x > n) return 1;
  memset(mp, 0, sizeof mp);
  int free = 0;
  int cnt = 0;
  for (int i = x; i >= 1; i--) {
    if ((arr[i] == 0 || mp[arr[i]] == 1) && free == 0) {
    } else if ((arr[i] == 0 || mp[arr[i]] == 1) && free)
      free--;
    else {
      free += ex[arr[i]];
      mp[arr[i]] = 1;
      cnt++;
    }
  }
  if (free || cnt < m)
    return 0;
  else
    return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &ex[i]);
  }
  int lo = 1, hi = n + n, mid, ans = n + n + n;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (ok(mid) == 1) {
      hi = mid - 1;
      ans = min(ans, mid);
    } else
      lo = mid + 1;
  }
  if (ans > n) ans = -1;
  printf("%d", ans), puts("");
  return 0;
}
