#include <bits/stdc++.h>
using namespace std;
int n, m, d[100001], a[100001], pre[100001], res, flag;
bool C(int x) {
  flag = 0, res = 0;
  memset(pre, 0, sizeof(pre));
  int i, k;
  for (i = x; i >= 1; i--) {
    if (d[i] != 0) {
      if (pre[d[i]] == 0) {
        pre[d[i]] = 1;
        flag++;
        res += a[d[i]];
      } else if (res != 0) {
        res--;
      }
    } else if (res != 0) {
      res--;
    }
  }
  if (flag != m || res != 0) {
    return false;
  }
  return true;
}
int solve() {
  int l = 1, r = n;
  if (C(r) == 0) {
    return -1;
  }
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (C(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return r;
}
int main() {
  int i, day;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &d[i]);
    }
    for (i = 1; i <= m; i++) {
      scanf("%d", &a[i]);
    }
    day = solve();
    printf("%d\n", day);
  }
  return 0;
}
