#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
int n, k, a[maxn], c[maxn];
bool was[maxn];
vector<int> g[maxn];
bool check(int pos) {
  memset(was, 0, sizeof(was));
  int used = 0, unused = pos;
  for (int i = pos; i >= 1; i--) {
    if (was[a[i]] || a[i] == 0) continue;
    if (unused > c[a[i]]) {
      was[a[i]] = 1;
      unused -= 1 + c[a[i]];
    }
  }
  for (int i = (1); i <= (k); ++i)
    if (!was[i]) return 0;
  return 1;
}
int main() {
  scanf("%d%d", &n, &k);
  vector<int> st;
  for (int i = (1); i <= (n); ++i) {
    scanf("%d", a + i);
    if (a[i] > 0) {
      g[a[i]].push_back(i);
      st.push_back(i);
    }
  }
  for (int i = (1); i <= (k); ++i) scanf("%d", c + i);
  int l = 0, r = (int)st.size() - 1, ans = -1;
  while (l <= r) {
    int m = (l + r) >> 1;
    if (check(st[m]))
      ans = m, r = m - 1;
    else
      l = m + 1;
  }
  if (ans == -1)
    puts("-1");
  else
    printf("%d", st[ans]);
  return 0;
}
